Code: Select all
Result$ = GetCurrentDirectory()But if I compile as a application ("test.app"), then the result is "/", the root directory on Mac.
I think, this is a bug, because the command was running on PB V 3.92.
BTW: The same results on V 4.10
Code: Select all
Result$ = GetCurrentDirectory()Code: Select all
Result$ = GetPathPart(ProgramFilename())
But the result is not the directory of the applicationts-soft wrote:The CurrentDirectory and the Application Path not allways the same!
Use:I think this is required.Code: Select all
Result$ = GetPathPart(ProgramFilename())
Code: Select all
MessageRequester("Current Directory", GetCurrentDirectory())
MessageRequester("Programmname", ProgramFilename())
MessageRequester("Nur Pfad: ",GetPathPart(ProgramFilename()))
MessageRequester("Nur File: ",GetFilePart(ProgramFilename()))
epos.l=FindString(GetCurrentDirectory(),GetFilePart(ProgramFilename())+".app",1)
MessageRequester("Bundle-Pfad", Left(GetCurrentDirectory(), epos-1))Code: Select all
/Users/Klaus/Programmieren/purebasic_Code/Test/compilertest.app/Contents/
/Users/Klaus/Programmieren/purebasic_Code/Test/compilertest.app/Contents/MacOs/compilertest
/Users/Klaus/Programmieren/purebasic_Code/Test/compilertest.app/Contents/MacOs/
compilertest
/Users/Klaus/Programmieren/purebasic_Code/Test/

And where i have to set this path?ts-soft wrote:> And that is surely not correct![]()
Is correct. CurrentDirectory is the currently setting Path for your Application,
but you haven't set any Path, so the path is unassigned
Code: Select all
SetCurrentDirectory("what ever you want as current directory")
Hm..., then in PB is changed something. I don't have changed my system, is the same Mac Os X as before. And with PB V. 3.94 I never had used the command 'SetCurrentDirectory()'.ts-soft wrote:> And where i have to set this path?In some situations, the creating process set the path, for example the pb-ideCode: Select all
SetCurrentDirectory("what ever you want as current directory")
or the filemanager, but if none set the path, the path is on your os "/"

Which tells me you didn't read my link.And that is surely not correct
That's why I think it's a bug.
If you had read my link I wouldn't have had to be so rude. Or maybe if I was just a nicer person I wouldn't have said anything.It does return the current directory. It just so happens that you don't know what the "current directory" is...
Sorry, Trond, I did not want to insult anybody.Trond wrote:Which tells me you didn't read my link.
Code: Select all
result$ = Left(GetPathPart(ProgramFilename()), FindString(GetPathPart(ProgramFilename()),GetFilePart(ProgramFilename())+".app",1)-1)

Many thanking, I desperately needed this.michel51 wrote:I solved my problem![]()
This line returns the 'bundlepath' of a application, where it is also stored.
Code: Select all
result$ = Left(GetPathPart(ProgramFilename()), FindString(GetPathPart(ProgramFilename()),GetFilePart(ProgramFilename())+".app",1)-1)

Code: Select all
Procedure.s GetProgramDirectory() ; Program Path
Protected ProgDir.s
ProgDir = GetPathPart(ProgramFilename())
If ProgDir = #PB_Compiler_Home+"Compilers\" Or ProgDir = GetTemporaryDirectory()
ProgDir = GetCurrentDirectory()
EndIf
ProcedureReturn ProgDir
EndProcedure