index 4ccf103f60553c2f5a8f64042c4787a944eac57f..a83cac88d039cb430256fc76b00c7c0495a679c6 100644 (file)
/*
- * Authors:
+ * Author:
* Ted Gould <ted@gould.cx>
*
- * Copyright (C) 2004 Authors
+ * Copyright (C) 2006 Johan Engelen, johan@shouraizou.nl
+ * Copyright (C) 2004 Author
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
#include <glibmm/i18n.h>
-
#include "config.h"
#include "path-prefix.h"
-
#include "dependency.h"
#include "db.h"
"executable",
"file",
"extension",
- "plugin",
};
// These strings are for XML attribute comparisons and should not be translated
looked up in the database. If the extension is found, and it is
not deactivated, the dependency passes.
- If the type is \c TYPE_PLUGIN then the path for the plugin is found
- using the Glib::Module routines. When the path is found, then there
- is a check to see if the file exists using the \c file_test function.
-
If the type is \c TYPE_EXECUTABLE or \c TYPE_FILE things are getting
even more interesting because now the \c _location variable is also
taken into account. First, the difference between the two is that
if (myext->deactivated()) return FALSE;
break;
}
- case TYPE_PLUGIN: {
- if (!Glib::Module::get_supported()) {
- return FALSE;
- }
-
- std::string path = Glib::Module::build_path(INKSCAPE_PLUGINDIR, _string);
- if (!Glib::file_test(path, Glib::FILE_TEST_EXISTS))
- return FALSE;
- break;
- }
case TYPE_EXECUTABLE:
case TYPE_FILE: {
Glib::FileTest filetest = Glib::FILE_TEST_EXISTS;
return TRUE;
}
+ // give it a 2nd try with ".exe" added
+ gchar * final_name_exe = g_strdup_printf("%s.exe", final_name);
+ if (Glib::file_test(final_name_exe, filetest)) {
+ g_free(final_name);
+ g_free(final_name_exe);
+ g_free(orig_path);
+ return TRUE;
+ }
+ g_free(final_name_exe);
+
+ // and a 3rd try with ".cmd" added (mainly for UniConvertor)
+ gchar * final_name_cmd = g_strdup_printf("%s.cmd", final_name);
+ if (Glib::file_test(final_name_cmd, filetest)) {
+ g_free(final_name);
+ g_free(final_name_cmd);
+ g_free(orig_path);
+ return TRUE;
+ }
+ g_free(final_name_cmd);
+
+ // give up
g_free(final_name);
}
std::ostream &
operator<< (std::ostream &out_file, const Dependency & in_dep)
{
- out_file << _("Dependency::") << std::endl;
- out_file << _(" type: ") << _(in_dep._type_str[in_dep._type]) << std::endl;
- out_file << _(" location: ") << _(in_dep._location_str[in_dep._location]) << std::endl;
- out_file << _(" string: ") << in_dep._string << std::endl;
+ out_file << _("Dependency:") << '\n';
+ out_file << _(" type: ") << _(in_dep._type_str[in_dep._type]) << '\n';
+ out_file << _(" location: ") << _(in_dep._location_str[in_dep._location]) << '\n';
+ out_file << _(" string: ") << in_dep._string << '\n';
if (in_dep._description != NULL) {
- out_file << _(" description: ") << _(in_dep._description) << std::endl;
+ out_file << _(" description: ") << _(in_dep._description) << '\n';
}
+ out_file << std::flush;
+
return out_file;
}