Fix the "Send to editor" bug on Windows ; for a reminder : you have to select the Gimp's base installation directory, not the "bin" subdir

This commit is contained in:
Hombre
2010-10-19 22:49:23 +02:00
parent 9b4b9e4d45
commit cb0930c436

View File

@@ -879,46 +879,69 @@ bool EditorPanel::idle_sentToGimp(ProgressConnector<int> *pc,rtengine::IImage16*
parent->setProgress(0.); parent->setProgress(0.);
bool success=false; bool success=false;
Glib::ustring cmdLine; Glib::ustring cmdLine;
Glib::ustring executable;
// start gimp // start gimp
if (options.editorToSendTo==1) { if (options.editorToSendTo==1) {
#ifdef _WIN32 #ifdef _WIN32
cmdLine = Glib::ustring("\"") + Glib::build_filename (Glib::build_filename(options.gimpDir,"bin"), "gimp-win-remote") + "\" gimp-2.4.exe" + " \"" + filename + "\""; executable = Glib::build_filename (Glib::build_filename(options.gimpDir,"bin"), "gimp-win-remote");
#else cmdLine = Glib::ustring("\"") + executable + Glib::ustring("\" gimp-2.4.exe ") + Glib::ustring("\"") + filename + Glib::ustring("\"");
cmdLine = Glib::ustring("gimp-remote ") + " \"" + filename + "\""; if ( Glib::file_test(executable, (Glib::FILE_TEST_EXISTS|Glib::FILE_TEST_IS_EXECUTABLE)) ) {
#endif
success = safe_spawn_command_line_async (cmdLine); success = safe_spawn_command_line_async (cmdLine);
}
#else
cmdLine = Glib::ustring("gimp-remote ") + Glib::ustring(" \"") + filename + Glib::ustring("\"");
success = safe_spawn_command_line_async (cmdLine);
#endif
if (!success){ if (!success){
#ifdef _WIN32 #ifdef _WIN32
int ver = 12; int ver = 12;
while (!success && ver) { while (!success && ver) {
cmdLine = Glib::ustring("\"") + Glib::build_filename (Glib::build_filename(options.gimpDir,"bin"), Glib::ustring::compose("gimp-2.%1.exe",ver)) + "\" \"" + filename + "\""; executable = Glib::build_filename (Glib::build_filename(options.gimpDir,"bin"), Glib::ustring::compose(Glib::ustring("gimp-2.%1.exe"),ver));
ver--; if ( Glib::file_test(executable, (Glib::FILE_TEST_EXISTS|Glib::FILE_TEST_IS_EXECUTABLE)) ) {
cmdLine = Glib::ustring("\"") + executable + Glib::ustring("\" \"") + filename + Glib::ustring("\"");
success = safe_spawn_command_line_async (cmdLine); success = safe_spawn_command_line_async (cmdLine);
} }
ver--;
}
#elif defined __APPLE__ #elif defined __APPLE__
cmdLine = Glib::ustring("gimp ") + " \"" + filename + "\""; cmdLine = Glib::ustring("gimp \"") + filename + Glib::ustring("\"");
success = safe_spawn_command_line_async (cmdLine); success = safe_spawn_command_line_async (cmdLine);
#else #else
cmdLine = Glib::ustring("gimp ") + " \"" + filename + "\""; cmdLine = Glib::ustring("gimp \"") + filename + Glib::ustring("\"");
success = safe_spawn_command_line_async (cmdLine); success = safe_spawn_command_line_async (cmdLine);
#endif #endif
} }
} }
else if (options.editorToSendTo==2) { else if (options.editorToSendTo==2) {
#ifdef __APPLE__ #ifdef _WIN32
cmdLine = Glib::ustring("open -a \'") + Glib::build_filename(options.psDir,"Photoshop.app\' ") + "\'" + filename + "\'"; executable = Glib::build_filename(options.psDir,"Photoshop.exe");
#else if ( Glib::file_test(executable, (Glib::FILE_TEST_EXISTS|Glib::FILE_TEST_IS_EXECUTABLE)) ) {
cmdLine = Glib::ustring("\"") + Glib::build_filename(options.psDir,"Photoshop.exe") + "\" \"" + filename + "\""; cmdLine = Glib::ustring("\"") + executable + Glib::ustring("\" \"") + filename + Glib::ustring("\"");
#endif
success = safe_spawn_command_line_async (cmdLine); success = safe_spawn_command_line_async (cmdLine);
} }
else if (options.editorToSendTo==3) {
#ifdef __APPLE__
cmdLine = Glib::ustring("") + options.customEditorProg + filename;
#else #else
cmdLine = Glib::ustring("\"") + options.customEditorProg + "\" \"" + filename + "\""; #ifdef defined __APPLE__
cmdLine = Glib::ustring("open -a \'") + Glib::build_filename(options.psDir,"Photoshop.app\' ") + Glib::ustring("\'") + filename + Glib::ustring("\'");
#else
cmdLine = Glib::ustring("\"") + Glib::build_filename(options.psDir,"Photoshop.exe") + Glib::ustring("\" \"") + filename + Glib::ustring("\"");
#endif #endif
success = safe_spawn_command_line_async (cmdLine); success = safe_spawn_command_line_async (cmdLine);
#endif
}
else if (options.editorToSendTo==3) {
#ifdef _WIN32
if ( Glib::file_test(options.customEditorProg, (Glib::FILE_TEST_EXISTS|Glib::FILE_TEST_IS_EXECUTABLE)) ) {
cmdLine = Glib::ustring("\"") + options.customEditorProg + Glib::ustring("\" \"") + filename + Glib::ustring("\"");
success = safe_spawn_command_line_async (cmdLine);
}
#else
#ifdef __APPLE__
cmdLine = options.customEditorProg + filename;
#else
cmdLine = Glib::ustring("\"") + options.customEditorProg + Glib::ustring("\" \"") + filename + Glib::ustring("\"");
#endif
success = safe_spawn_command_line_async (cmdLine);
#endif
} }
if (!success) { if (!success) {