this code generates two small files:
Code: Select all
CreatePreferences("x.ini")
PreferenceGroup("test")
WritePreferenceString("name", "PB")
ClosePreferences()
CreateFile(0, "x.txt")
WriteString(0, "Hello")
CloseFile(0)Code: Select all
CreatePreferences("x.ini")
PreferenceGroup("test")
WritePreferenceString("name", "PB")
ClosePreferences()
CreateFile(0, "x.txt")
WriteString(0, "Hello")
CloseFile(0)No!ts-soft wrote:the same problem on all OS.
i have posted a hint on this more than 10x in german-boardLebostein wrote:Hm... you could have right.
But I have not seen a PB source code in my life (not in forum, not in example folder and not in code archiv), in which the current path was set...
Code: Select all
exe.s = ProgramFilename()
CompilerIf #PB_Compiler_OS = #PB_OS_MacOS: exe = Left(exe, FindString(exe, "/Contents/MacOS/", 1) - 1): CompilerEndIf
SetCurrentDirectory(GetPathPart(exe))That's right, because the ini-file is not within the application-folder.Lebostein wrote:OK. In directory
/Users/Lebostein/DATEN/PureBasic/TomyTex
I have two files
> Setting.ini
> TomyTex.pb
If I run TomyTex.pb with IDE, the program can open the ini file with simple OpenPreferences("Setting.ini") without problems. If I check the execution path with ProgramFilename() I get
/tmp/PureBasic0.app/Contents/MacOS/PureBasic0
Why my program finds the ini file? The execution path is an other!
However: If I generate an app an run this app, I get
/Users/Lebostein/DATEN/PureBasic/TomyTex/TomyTex.app/Contents/MacOS/TomyTex
with ProgramFilename(). The right path this time, but the program don't find the ini file...

Hi WilliamL,WilliamL wrote:Hey michel51, how's it going?
You're right the files are in the Contents folder and if you have to update your files you can make a tool. I made a tool to re-save my (modified) plist over the default that is created every time the app is created.