Skip to content

Commit

Permalink
Only create executable path when executable is used
Browse files Browse the repository at this point in the history
  • Loading branch information
FabianTerhorst committed Jun 12, 2019
1 parent ce97a6d commit 46ee0c9
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions runtime/src/CoreClr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,6 @@ void CoreClr::CreateAppDomain(alt::IServer* server, alt::IResource* resource, co

auto nativeDllPaths = alt::String(appPath) + LIST_SEPARATOR + runtimeDirectory;

auto executablePath = alt::String(appPath) + PATH_SEPARATOR + resource->GetMain();

const char* propertyKeys[] = {
"TRUSTED_PLATFORM_ASSEMBLIES",
"APP_PATHS",
Expand Down Expand Up @@ -275,6 +273,8 @@ void CoreClr::CreateAppDomain(alt::IServer* server, alt::IResource* resource, co
}

if (executable) {
auto executablePath = alt::String(appPath) + PATH_SEPARATOR + resource->GetMain();

server->LogInfo(alt::String("coreclr-module: Prepare for executing assembly:") + executablePath);
int exitCode = -1;
const char* args[1];
Expand All @@ -288,7 +288,7 @@ void CoreClr::CreateAppDomain(alt::IServer* server, alt::IResource* resource, co
1,
args,
executablePath.CStr(),
(unsigned int*)&exitCode
(unsigned int*) &exitCode
);

if (result < 0) {
Expand All @@ -297,7 +297,7 @@ void CoreClr::CreateAppDomain(alt::IServer* server, alt::IResource* resource, co
alt::String("coreclr-module: Unable to execute assembly in app path:") + executablePath);
this->PrintError(server, result);
} else {
server->LogInfo("coreclr-module: Assembly executed");
server->LogInfo(alt::String("coreclr-module: Assembly executed"));
char* x_str = new char[10];
sprintf(x_str, "exit code: %d", exitCode);
server->LogInfo(
Expand Down Expand Up @@ -339,7 +339,7 @@ void CoreClr::GetPath(alt::IServer* server, const char* defaultPath) {
greatest = entry->d_name;
continue;
}
if(semver_parse(entry->d_name, &compare_version)) {
if (semver_parse(entry->d_name, &compare_version)) {
server->LogInfo(alt::String("coreclr-module: invalid version found: ") + entry->d_name);
continue;
}
Expand Down

0 comments on commit 46ee0c9

Please sign in to comment.