Set current dir at runtime

Maybe later we could have an option for this
This commit is contained in:
BigDave 2018-07-17 19:44:41 +01:00
父節點 a7b33fd4dc
當前提交 7dcf01fdf6
簽署人: BigDave
GPG Key ID: 2787C0A942BB86EC
共有 2 個文件被更改,包括 21 次插入1 次删除

查看文件

@ -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");
}