Change the working directory not possible

Post your Gambas programming questions here.
Post Reply
User avatar
thatbruce
Posts: 168
Joined: Saturday 4th September 2021 11:29pm

Change the working directory not possible

Post by thatbruce »

Maybe this is a linux thing?

I discovered today that I can't change the application working directory.

I have project that needs to wander around a set of related directories and process the files therein. Tracking where I am is proving @#! difficult. So thought I what about changing the working directory, then the relative paths would be simple. This appears to be "not possible" AFAICS.

Any thoughts/
gracias
b
Have you ever noticed that software is never advertised using the adjective "spreadable".
User avatar
cogier
Site Admin
Posts: 1127
Joined: Wednesday 21st September 2016 2:22pm
Location: Guernsey, Channel Islands

Re: Change the working directory not possible

Post by cogier »

I have project that needs to wander around a set of related directories and process the files therein.
I would create a new folder as your 'working directory' e.g.

Public sPath As String = User.Home &/ "MyNewFolder"

Public Sub Form_Open()

  If Not Exist(sPath) Then Mkdir sPath

End


Then you can create new folders and move around them with ease using sPath as the 'root'.

Or have I missed something here?
vuott
Posts: 263
Joined: Wednesday 5th April 2017 6:07pm
Location: European Union

Re: Change the working directory not possible

Post by vuott »

:? ...perhaps you could use the external function "chdir()" via Gambas "Extern" keyword:

https://pubs.opengroup.org/onlinepubs/9 ... chdir.html
https://man7.org/linux/man-pages/man2/chdir.2.html
Europaeus sum !

Amare memorentes atque deflentes ad mortem silenter labimur.
User avatar
thatbruce
Posts: 168
Joined: Saturday 4th September 2021 11:29pm

Re: Change the working directory not possible

Post by thatbruce »

(still looking at both these ideas. I'll let you know.)
Have you ever noticed that software is never advertised using the adjective "spreadable".
Post Reply