Page 1 of 1

CreateDirectory - I can't get it to work

Posted: Tue Jun 19, 2007 6:14 pm
by Straker
Here's my code:

Code: Select all

gMyDir.s = "~/mydir"
Debug CreateDirectory(gMyDir.s)
Always returns 0

The problem lies in the "~" which is the wildcard to the home directory. It works with a fully qualified path, i.e. "/home/user/mydir", but I won't know this so how can I achieve this directory creation with the wildcard?

Thanks

Posted: Tue Jun 19, 2007 6:20 pm
by ts-soft
Why not simple use:

Code: Select all

gMyDir.s = GetHomeDirectory() + "mydir"
Debug CreateDirectory(gMyDir.s) 
?

Posted: Tue Jun 19, 2007 6:29 pm
by Trond
~ is expanded by the shell. It's not a part of the filesystem. PB's file commands doesn't go through a shell.

Posted: Tue Jun 19, 2007 7:59 pm
by Straker
GetHomeDirectory() worked.

Thanks for the tips guys.