Change current directory from ROOT command line

Hey ROOTers,

I am working on a GUI that needs to allow users to execute unnamed macros using:

where “path/myMacro.C” is acquired using a file browser. This works for macros that have no dependencies on files in their own directories. But if, for instance, myMacro.C needs to use, or pull information from myData.txt that is in the same directory as myMacro.C, it cannot find those dependencies. I suspect that this would work if I could somehow change the current directory of the ROOT environment. However, I have been unsuccessful in my attempts to do this.(something like “.!cd aDirectory” doesn’t work) I believe if I could figure out how to do this from the command line I could use

to do it in a compiled macro.

I am working in Ubuntu 10.04 using ROOT version 5.18.


Hi Caleb,

Try gSystem->ChangeDirectory("path"); or gSystem->cd("path");

Cheers, Bertrand.

This worked swimmingly.