UseDirectory(Path.s) or even better...
UseDirectory(Path.s) or even better...
ChgDir(Path.s)
There are two different things:
PureBasic's <b>default</b> directory is not (necessarily) the <b>current</b> directory.
If you have a command parameter with a file name based on the
current directory, you have to get the current directory by
API and construct the full path.
What we need is a PB command:
SetPBdefaultDirectory(path)
or:
SetPBdefaultToCurrentDirectory()
Of course it would be better if PB would use the current directory
as default, but that would not be backward compatible.
PureBasic's <b>default</b> directory is not (necessarily) the <b>current</b> directory.
If you have a command parameter with a file name based on the
current directory, you have to get the current directory by
API and construct the full path.
What we need is a PB command:
SetPBdefaultDirectory(path)
or:
SetPBdefaultToCurrentDirectory()
Of course it would be better if PB would use the current directory
as default, but that would not be backward compatible.
Horst.
bump: anyone have a solution? For example, I want to allow the user to select a directory to become the default from which the program can then open files using *relative* paths such as "data/mylogo.bmp" or "../global/stdlogo.bmp". I'd prefer not be constantly fixing-up paths just because PB won't register a directory change.
Currently the only solution is using the API funktion:dmoc wrote:... I want to allow the user to select a directory to become the default from which the program can then open files using *relative* paths such as "data/mylogo.bmp" or "../global/stdlogo.bmp". I'd prefer not be constantly fixing-up paths just because PB won't register a directory change.
GetFullPathName_(...)
I made this small PB function for my batch tools:
(This one ignores empty source srings)
Code: Select all
Procedure.s CompletePath(fname.s)
If fname
buf_.s = Space(#MAX_PATH) : fp_.l
len = GetFullPathName_(fname,#MAX_PATH,@buf_,@fp_)
If len : fname = buf_ : EndIf
EndIf
ProcedureReturn fname
EndProcedure
Horst.