Set current dir at runtime
Maybe later we could have an option for this
This commit is contained in:
parent
a7b33fd4dc
commit
7dcf01fdf6
|
@ -40,6 +40,7 @@
|
|||
"files.associations": {
|
||||
"ph7int.h": "c",
|
||||
"ph7.h": "c",
|
||||
"stdlib.h": "c"
|
||||
"stdlib.h": "c",
|
||||
"direct.h": "c"
|
||||
}
|
||||
}
|
|
@ -184,6 +184,25 @@ int main(int argc, char **argv) {
|
|||
PH7_VM_CONFIG_IMPORT_PATH,
|
||||
"test"
|
||||
);
|
||||
|
||||
char* cwd;
|
||||
// Get the current working directory:
|
||||
#ifdef __WINNT__
|
||||
if((cwd = _getcwd( NULL, 0 )) == NULL)
|
||||
#else
|
||||
if((cwd = getcwd( NULL, 0 )) == NULL)
|
||||
#endif
|
||||
perror("_getcwd error");
|
||||
else
|
||||
{
|
||||
printf("cwd: %s\n", cwd);
|
||||
rc = ph7_vm_config(pVm,
|
||||
PH7_VM_CONFIG_IMPORT_PATH,
|
||||
cwd
|
||||
);
|
||||
free(cwd);
|
||||
}
|
||||
|
||||
if(rc != PH7_OK) {
|
||||
Fatal("Error while installing the VM output consumer callback");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue