i have a django web that on certain actions is calling a .exe on the server using this:
proc = subprocess.Popen([r'C:/.../django/project/app/program.exe', 'arg1', 'arg2', ..], stdout=subprocess.PIPE)
s = proc.stdout.read()
proc.wait()
The problem is that program.exe, in turn, has to open some files on the server. This files are called by the code (in c++) using relative path, and are stored at the same folder where the .exe is. When I run program.exe from the IDE or the terminal it works like a charm, but not when it is at the server.
I have done a simple program in c++and placed it at the same folder as program.exe to know what is the current path when program.exe is run at the server:
#define GetCurrentDir _getcwd
int main(int argc, char* argv[]{
char cCurrentPath[FILENAME_MAX];
GetCurrentDir(cCurrentPath, sizeof(cCurrentPath));
std::cout << cCurrentPath << std::endl;
}
And in state of returning C:/.../django/project/app, it returns C:/.../django/project. I know I can set the path of the files relative to cCurrentPath, but is there any other way to do it, by changing the server configuration?
I am using 2 different servers, apache and the django development server on windows.