Skip to content

Commit

Permalink
HostAppRun(): Convert relative path of the program to absolute path
Browse files Browse the repository at this point in the history
  • Loading branch information
maron2000 committed Oct 18, 2024
1 parent 80a1947 commit 2ccbdcf
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/dos/dos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -843,6 +843,7 @@ void HostAppRun() {
char comline[256], *p=comline;
char winDirCur[512], winDirNew[512], winName[256], dir[CROSS_LEN+15];
char *fullname=appname;
std::string winPath;
uint8_t drive;
if (!DOS_MakeName(fullname, winDirNew, &drive)) return;
bool net = false;
Expand Down Expand Up @@ -892,6 +893,16 @@ void HostAppRun() {
strcpy(winDirNew, useoverlay?odp->getOverlaydir():Drives[drive]->GetBaseDir());
strcat(winDirNew, Drives[drive]->curdir);
}
if(!(std::isalpha(winDirNew[0]) && winDirNew[1] == ':') && winDirNew[0] != '\\') {
//LOG_MSG("not a absolute path");
winPath = winDirCur + std::string("\\") + std::string(winDirNew);
strcpy(winDirNew, winPath.c_str());
}
if(!(std::isalpha(winName[0]) && winName[1] == ':') && winName[0] != '\\') {
//LOG_MSG("not a absolute path");
winPath = winDirCur + std::string("\\") + std::string(winName);
strcpy(winName, winPath.c_str());
}
if (SetCurrentDirectory(winDirNew)||net) {
SHELLEXECUTEINFO lpExecInfo;
strcpy(comline, appargs);
Expand Down

0 comments on commit 2ccbdcf

Please sign in to comment.