Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
Juri74 Senior Member Joined: 06/02/2012 Location: ItalyPosts: 162
Posted: 03:28am 14 Mar 2013
Copy link to clipboard
Print this post
i'm a little bit confused about moving trough directories in a program..
suppose you have an empty sdcard with two directories:
GAMES
APPS
now chdir to directory GAMES
when in GAMES store path in a variable T$=Cwd$
now chdir to APPS directory
when in APPS directory if you type 'Chdir T$' you remain in APPS directory
why? could someone help please?
Juri
greybeard Senior Member Joined: 04/01/2010 Location: AustraliaPosts: 174
Posted: 03:45am 14 Mar 2013
Copy link to clipboard
Print this post
I suspect the path is relative to where you are. Try printing out what you have in T$ when you save the path.
To get to APPS from GAMES you would need to go up a directory level and then back down again. But what you are doing in your test code is trying to change directory from B:/GAMES to B:/GAMES/APPS instead of B:/APPS I reckon T$ only has "APPS" in it when you loaded Cwd$ into it. ( I may have the / the wrong way around but you should be able to see what I mean )
A good tip when something doesn't work is to print out all the variables to see what is actually in them.
cheers
Rod
Juri74 Senior Member Joined: 06/02/2012 Location: ItalyPosts: 162
Posted: 04:14am 14 Mar 2013
Copy link to clipboard
Print this post
Hello i tried a bit and i noticed that
the T$ variable appear to store the entire path (B:\GAMES or B:\APPS)
i tried by hands and it appear that if i remove the drive name the Chdir command start working
example i'm in APPS directory and i want to go to GAMES directory
if i type: Chdir "\GAMES" it work
but if i type: Chdir "B:\GAMES" it doesn't work
EDIT: probably Chdir should work in that way because the command Drive is used to change drive, i could type Chdir "A:\somedir" while i'm in B: drive...
i found a workaround my original line was "bkd$=Cwd$" (bkd$ is to back up path)
now is "bkd$=Right$(Cwd$,len(Cwd$)-2)"