This partially implements #16 - currently only for entry file.
This commit is contained in:
parent
11b4c95c6f
commit
a9637d2c8a
|
@ -624,6 +624,7 @@ static sxi32 ProcessScript(
|
|||
ph7_vm *pVm;
|
||||
int iFileDir, rc;
|
||||
char *pFileDir, *fFilePath[PATH_MAX + 1];
|
||||
char *pFilePath[PATH_MAX + 1];
|
||||
/* Allocate a new virtual machine */
|
||||
pVm = (ph7_vm *)SyMemBackendPoolAlloc(&pEngine->sAllocator, sizeof(ph7_vm));
|
||||
if(pVm == 0) {
|
||||
|
@ -650,13 +651,14 @@ static sxi32 ProcessScript(
|
|||
/* Install local import path which is the current directory */
|
||||
ph7_vm_config(pVm, PH7_VM_CONFIG_IMPORT_PATH, "./");
|
||||
if(zFilePath && SyRealPath(zFilePath, fFilePath) == PH7_OK) {
|
||||
snprintf(pFilePath, sizeof(pFilePath) - 1, "%s", fFilePath);
|
||||
/* Extract directory name containing processed file */
|
||||
pFileDir = PH7_ExtractDirName(fFilePath, SyStrlen(fFilePath), &iFileDir);
|
||||
pFileDir[iFileDir + 1] = '\0';
|
||||
/* Install local import path which is directory containing entry script */
|
||||
ph7_vm_config(pVm, PH7_VM_CONFIG_IMPORT_PATH, pFileDir);
|
||||
/* Push processed file path */
|
||||
PH7_VmPushFilePath(pVm, zFilePath, -1, TRUE, 0);
|
||||
PH7_VmPushFilePath(pVm, pFilePath, -1, TRUE, 0);
|
||||
}
|
||||
/* Reset the error message consumer */
|
||||
SyBlobReset(&pEngine->xConf.sErrConsumer);
|
||||
|
|
Loading…
Reference in New Issue