#include "omnplay.h"
#include "support.h"
+#ifdef _WIN32
+#include <ctype.h>
+#include <windows.h>
+
+char *strcasestr(char *haystack, char *needle)
+{
+ char *p, *startn = 0, *np = 0;
+
+ for (p = haystack; *p; p++) {
+ if (np) {
+ if (toupper(*p) == toupper(*np)) {
+ if (!*++np)
+ return startn;
+ } else
+ np = 0;
+ } else if (toupper(*p) == toupper(*needle)) {
+ np = needle + 1;
+ startn = p;
+ }
+ }
+
+ return 0;
+};
+#endif /* _WIN32 */
+
int main(int argc, char **argv)
{
- char path[ 512 ];
+ char path[ 512 ], *buf;
omnplay_instance_t *app = NULL;
#ifdef ENABLE_NLS
gtk_set_locale();
gtk_init(&argc, &argv);
+ memset(path, 0, sizeof(path));
#ifdef _WIN32
+ GetModuleFileName(NULL, path, sizeof(path));
+// g_warning("GetModuleFileName [%s]\n", path);
+ if((buf = strstr(path, "\\bin\\omnplay.exe")))
+ {
+ buf[0] = 0;
+ strcat(path, "\\share\\omnplay\\pixmaps");
+ }
#else
// Linux hack to determine path of the executable
- readlink( "/proc/self/exe", path, 512);
- if ( strstr( path, "/bin/rugen" ) )
+ readlink( "/proc/self/exe", path, sizeof(path));
+ g_warning ("path=(%s)\n", path);
+ if((buf = strstr(path, "/bin/omnplay")))
{
- ( *strstr( path, "/bin/rugen" ) ) = '\0';
- strcat( path, "/share/rugen/pixmaps" );
- add_pixmap_directory( path );
+ buf[0] = 0;
+ strcat(path, "/share/omnplay/pixmaps");
}
- else
+ else if((buf = strstr(path, "/src/omnplay")))
{
- add_pixmap_directory( PACKAGE_DATA_DIR "/" PACKAGE "/pixmaps" );
+ buf[0] = 0;
+ strcat( path, "/pixmaps" );
}
+ else
+ snprintf(path, sizeof(path), "%s/%s/pixmaps", PACKAGE_DATA_DIR, PACKAGE);
#endif /* _WIN32 */
+ add_pixmap_directory( path );
+ g_warning ("add_pixmap_directory(%s)\n", path);
+
app = omnplay_create(argc, argv);
- gtk_widget_show (app->window);
- gdk_threads_enter();
- omnplay_init(app);
- gtk_main ();
- gdk_threads_leave();
+ if(app->window)
+ {
+ gtk_widget_show (app->window);
+ gdk_threads_enter();
+ omnplay_init(app);
+ gtk_main ();
+ gdk_threads_leave();
+ };
- omnplay_close(app);
+ omnplay_destroy(app);
return 0;
}