On Sun, 14 Dec 2014, Lewis Balentine wrote: > I can find out what the current directory is with: > Print Application.Env["PWD"] > > However there does not seem to be anything to change the present working > directory within the "File & Directory Functions". > I did try using the shell function. It did not seem to have the desired > effect. > Print Application.Env["PWD"] > Shell ("cd /mnt/Data/videos") > Wait 0.1 > Print Application.Env["PWD"] > ---------- > /home/lewis > /home/lewis > > So I guess that I have missed something obvious again.
Yes, using Shell "cd /another/directory" spawns a new process (the shell) which changes its directory (using the cd built-in) to /another/directory and then dies. Since the CWD is local to a process, this does nothing with your Gambas process. > How does one change the current directory in a Gambas console based > program ? > There is no concept of a current working directory in Gambas, as stated here[0]. If you want to change the CWD of your process nevertheless, I guess you can use Extern[1] and access the chdir() function in the C library but I don't know what consequences that will have. A cleaner solution is to use absolute paths throughout. The CWD from process startup time is found in Application.Dir. If you didn't call chdir() since then, it will give you your CWD and any relative path sRel can be made into an absolute path via Application.Dir &/ sRel Regards, Tobi [0] http://gambaswiki.org/wiki/lang/path [1] http://gambaswiki.org/wiki/lang/extdecl -- "There's an old saying: Don't change anything... ever!" -- Mr. Monk ------------------------------------------------------------------------------ Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration & more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user