/[svn]/linuxsampler/trunk/src/hostplugins/vst/PluginVst.cpp
ViewVC logotype

Diff of /linuxsampler/trunk/src/hostplugins/vst/PluginVst.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2045 by persson, Sun Jan 10 13:22:19 2010 UTC revision 2165 by persson, Sun Feb 20 14:20:22 2011 UTC
# Line 1  Line 1 
1  /***************************************************************************  /***************************************************************************
2   *                                                                         *   *                                                                         *
3   *   Copyright (C) 2008 - 2010 Andreas Persson                             *   *   Copyright (C) 2008 - 2011 Andreas Persson                             *
4   *                                                                         *   *                                                                         *
5   *   This program is free software; you can redistribute it and/or modify  *   *   This program is free software; you can redistribute it and/or modify  *
6   *   it under the terms of the GNU General Public License as published by  *   *   it under the terms of the GNU General Public License as published by  *
# Line 43  namespace { Line 43  namespace {
43    
44      void log(const char* fmt, ...) {      void log(const char* fmt, ...) {
45          logmutex.Lock();          logmutex.Lock();
46          FILE* f = fopen("C:\\linuxsamplervst.log", "a");          FILE* f = fopen((String(getenv("TEMP")) + "\\linuxsamplervst.log").c_str(), "a");
47          va_list ap;          va_list ap;
48          va_start(ap, fmt);          va_start(ap, fmt);
49          vfprintf(f, fmt, ap);          vfprintf(f, fmt, ap);
# Line 113  namespace { Line 113  namespace {
113                  FindClose(hFind);                  FindClose(hFind);
114    
115                  // start a java process                  // start a java process
116                  STARTUPINFO si;                  String path; // look in PATH first
117                  PROCESS_INFORMATION pi;                  for (int i = 0 ; i < 2 ; i++) { // two tries
118                  ZeroMemory(&si, sizeof(si));                      STARTUPINFO si;
119                  si.cb = sizeof(si);                      PROCESS_INFORMATION pi;
120                  ZeroMemory(&pi, sizeof(pi));                      ZeroMemory(&si, sizeof(si));
121                        si.cb = sizeof(si);
122                  Command = _tcsdup(TEXT((String("javaw -jar \"") + lspath + fantasia + "\"").c_str()));                      ZeroMemory(&pi, sizeof(pi));
123                  CreateProcess(NULL, Command, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);  
124                  ProcessHandle = pi.hProcess;                      Command = _tcsdup(TEXT((String("\"") + path + "javaw\" -jar \"" +
125                  CloseHandle(pi.hThread);                                              lspath + fantasia + "\"").c_str()));
126                        if (CreateProcess(NULL, Command, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi)) {
127                            ProcessHandle = pi.hProcess;
128                            CloseHandle(pi.hThread);
129                            break;
130                        } else {
131                            free(Command);
132                            if (path.empty()) {
133                                // java wasn't found in PATH, try again
134                                // with an alternative directory
135                                char* windir = getenv("windir");
136                                if (!windir) break;
137    #ifdef _WIN64
138                                // LS plugin is 64 bit - look for 32 bit java
139                                path = String(windir) + "\\SysWOW64\\";
140    #else
141                                // LS plugin is 32 bit - look for 64 bit java
142                                path = String(windir) + "\\Sysnative\\";
143    #endif
144                            }
145                        }
146                    }
147              }              }
148          }          }
149  #endif  #endif

Legend:
Removed from v.2045  
changed lines
  Added in v.2165

  ViewVC Help
Powered by ViewVC