Skip to content

Commit

Permalink
Fix: set python working dir same as the launcher executable dir
Browse files Browse the repository at this point in the history
  • Loading branch information
GChristensen committed Apr 20, 2012
1 parent ef3f6e9 commit 49cc6cd
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
/launcher/launcher/*.user
/enso/run-enso.exe
/enso/python
/enso/*.ilk
/enso/*.ilk
/enso-portable.7z.sfx.exe
Binary file modified launcher/launcher.suo
Binary file not shown.
1 change: 1 addition & 0 deletions launcher/launcher/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/Release/
9 changes: 6 additions & 3 deletions launcher/launcher/launcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#define MAX_ARGS_LENGTH 260

DWORD LaunchTarget(const TCHAR *target, const TCHAR *arguments)
DWORD LaunchTarget(const TCHAR *target, const TCHAR *arguments, const TCHAR *dir)
{
STARTUPINFOW siStartupInfo;
PROCESS_INFORMATION piProcessInfo;
Expand All @@ -24,7 +24,7 @@ DWORD LaunchTarget(const TCHAR *target, const TCHAR *arguments)
_tcsncpy(args + target_len + 3, arguments, MAX_ARGS_LENGTH - target_len - 4);

if (CreateProcess(target, args, NULL, NULL, TRUE, CREATE_NO_WINDOW,
NULL, NULL, &siStartupInfo, &piProcessInfo))
NULL, dir, &siStartupInfo, &piProcessInfo))
{
CloseHandle(piProcessInfo.hProcess);
CloseHandle(piProcessInfo.hThread);
Expand Down Expand Up @@ -67,11 +67,14 @@ int APIENTRY _tWinMain(HINSTANCE hInstance,

// Python path
TCHAR python_path[MAX_PATH];
TCHAR exec_dir[MAX_PATH];
lstrcpyn(python_path, module_name, module_name_len);

point = _tcsrchr(python_path, _T('\\'));
*(++point) = NULL;

_tcscpy(exec_dir, python_path);

SetEnvironmentVariable(_T("PYTHONPATH"), python_path);

_tcscpy(point, _T("python\\pythonw.exe"));
Expand All @@ -83,5 +86,5 @@ int APIENTRY _tWinMain(HINSTANCE hInstance,
point = _tcsrchr(enso_executable_path, _T('\\'));
_tcscpy(point + 1, _T("scripts\\run_enso.py"));

return LaunchTarget(python_path, enso_executable_path);
return LaunchTarget(python_path, enso_executable_path, exec_dir);
}
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ A portable distribution of the *community* version of Humanized Enso Launcher fo

(C) 2011-2012 g/christensen (gchristnsn@gmail.com)

v0.1.2
v0.1.3

---

Expand Down

0 comments on commit 49cc6cd

Please sign in to comment.