[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Fwd: how to change directory of work?


-------- Message transféré --------
Sujet : Re: how to change directory of work?
Date : Mon, 14 Apr 2025 01:38:46 +0200
De : roberto.premoli@xxxxxxxxxx
Pour : Benoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx>

Il 13.04.2025 23:26 Benoît Minisini ha scritto:

Le 13/04/2025 à 23:18, Bruce Steers a écrit :

On Sun, 13 Apr 2025 at 21:28, > wrote: __ hello. im writing a frontend
with gambas to a program (no matter it now), lets call it
"executable_cli". This program is in /somewhere/path/to/program, in my
case: "/home/user/path/to/program" so i use shell
"/home/user/path/to/program" I do what i do into executable_ci, close
it and back to frontend. all good till now. But the executable_cli
suppose to find and save data in his current directory that is
/home/user/path/to/program but frontend current directory is /home/user executable_chi cannot be parametrized with some flag to tell hime where save data and from where retrive data, it supposes always tht place is
here it is in the filesystem and I cannot change the executable
behaviour. so, from gambas, i try to do: shell "cd
/home/user/path/to/program" shell
"/home/user/path/to/program/executable_cli" but i does not work exec
["cd /home/user/path/to/program"] does not work either. so, who to tell gambas to "move into" /somewhere/path/to/program? Thanks Roberto there is no such thing as a "working directory" in gambas. every time you run Shell you create a new process so you cannot run "cd dir" in one Shell command then another Shell command be in that dir. You could do it in
one single Shell command by using a newline.. Shell "cd
/home/user/path/to/programn" & "executable_cli" But you cannot change
the applications working directory. BruceS

Otherwise you can actually specify the working directory in Exec or
Shell by specifying it the "PWD" environment variable.

Exec ["pwd"] With ["PWD=/root"] Wait

It's an undocumented Gambas feature.

Regards,

-- Benoît Minisini.



Hello Mr. Minisini,
i tried this:

  Message(User.home) 'test: it prints "/home/utente"
  Exec ["pwd"] With ["PWD=/home/utente/Immagini"] Wait
  Message(User.home) 'test: it prints "/home/utente"

but user.home in not affected.

Thnks,
Roberto



Follow-Ups:
Re: Fwd: how to change directory of work?Benoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx>
Re: how to change directory of work?Bruce Steers <bsteers4@xxxxxxxxx>