Got an idea for enhancing PureBasic? New command(s) you'd like to see?
naw
Enthusiast
Posts: 573 Joined: Fri Apr 25, 2003 4:57 pm
Post
by naw » Thu Nov 17, 2005 5:29 pm
Hi,
It appears that the only way to get the Current Working Directory name is like this:
Code: Select all
curPath.s=Space(#MAX_PATH)
GetCurrentDirectory_(#MAX_PATH,@curPath)
curPath+"\"
- which is fine, but only available for Windows. Can we please have a legitimate X-Platform PB command to do the same
Ta - N
phillip
New User
Posts: 4 Joined: Sat Dec 10, 2005 7:11 am
Post
by phillip » Mon Dec 12, 2005 10:18 pm
If your using linux you can always write the envirorment varable to the file, open and read the varable. Just type export to find it.
Phillip Taylor
naw
Enthusiast
Posts: 573 Joined: Fri Apr 25, 2003 4:57 pm
Post
by naw » Tue Dec 13, 2005 1:09 am
Hi Phillip,
- Yes thats a good idea. But for sucha simple function, it would be nice to have a native PB command. That would cross-compile.
Ta - N
ts-soft
Always Here
Posts: 5756 Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany
Post
by ts-soft » Tue Dec 13, 2005 1:26 am
You can use this:
Code: Select all
Procedure.s GetCurrentDir()
Protected CurDir.s
CurDir.s = Space(2048)
CompilerIf #PB_Compiler_OS = #PB_OS_Linux
getcwd_(CurDir, 2048)
CompilerElse
GetCurrentDirectory_(2048,CurDir)
CompilerEndIf
ProcedureReturn CurDir
EndProcedure
Debug GetCurrentDir()
PureBasic 5.73 |
SpiderBasic 2.30 |
Windows 10 Pro (x64) |
Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.