Compiler Working Directory

Compiler Working Directory

1
NewbieNewbie
1

    Jun 27, 2013#1

    Hi,

    I have an obscure compiler that only allows the configuration files to specify a filename (no path). The upshot of this is that the current directory needs to be set to the project path.

    I've tried using the "Working Directory" entry in the compiler settings, but this seems to only affect the output file.

    Anyone know of a way to ensure the compiler is working in the project directory?

    I also tried adding a [Build] command before the compiler runs:
    Cmd1 = cd "$Pp"

    But it didn't help.

    Thanks,
    Matt.

    6,603548
    Grand MasterGrand Master
    6,603548

      Jun 27, 2013#2

      Hm, I inserted

      Cmd0=cd /D "$Pp"

      in the configuration file in section [Build] and section [.C] (C compiler). After enabling option Show build commands when executing enabled under Build - Advanced Build Options and running a build, it looked like the command is working.

      To verify that I inserted as second command

      Cmd1=dir /B

      As I executed now the build command, I could see in the output window all subdirectories and files in the directory configured as project directory. Okay, it works! Really? I changed the first command to

      Cmd0=cd /D "C:\Temp"

      and executed again Rebuild All. But in output window still the subdirectories and files in the project directory are listed and not the files in C:\Temp. So UEStudio sets the project directory most likely automatically as working directory on executing compile/build and the change directory command is ignored completely.

      Perhaps the command cd fails because UEStudio (more precise: mymake.exe) tries to find cd.exe in all directories listed in environment variable PATH. As this fails mymake.exe tries to find next cd \D.exe which fails, too. However, that does not matter as the same procedure is done for dir.exe and dir \B.exe, but the cmd.exe internal command dir is definitely executed, otherwise the subdirectories and files in project directory would not be listed in the output window.

      But I could see in process monitor log why the change directory command does not result in changing working directory to C:\Temp. Command cd is executed, but by cmd.exe which executed in a separate process. So the working directory is set in this separate process, but when next command is executed, the working directory is again what UEStudio set as working directory on starting mymake.exe.

      However, for your compiler requirement it should be enough to set the project directory in the project settings dialog to the directory containing the files to compile.

      Use also the advanced build option Show build commands when executing to verify how the compiler is called.

      If there is the need to change to a different directory as the project directory before running the compiler, I can only suggest to put all commands needed into a batch file and call with Cmd0= the batch file passing the parameters which change to the batch file.

      Perhaps also possible, but not verified by me, is to use the command start which is a built-in command of cmd.exe. Run in a command prompt window start /? to see help of this command. Try following:

      Cmd0= start "Build" "/D$Pp" /wait build command with the parameters