unix.c
changeset 1050 e76fa5c5d835
parent 1010 17470a8e5eb7
child 1093 e8d26c7dc42f
equal deleted inserted replaced
1049:df4df87f0a08 1050:e76fa5c5d835
   406 
   406 
   407 	qsort(languages, num, sizeof(char*), LanguageCompareFunc);
   407 	qsort(languages, num, sizeof(char*), LanguageCompareFunc);
   408 	return num;
   408 	return num;
   409 }
   409 }
   410 
   410 
       
   411 #if defined(__BEOS__) || defined(__linux__)
   411 static void ChangeWorkingDirectory(char *exe)
   412 static void ChangeWorkingDirectory(char *exe)
   412 {
   413 {
   413 	char *s = strrchr(exe, '/');
   414 	char *s = strrchr(exe, '/');
   414 	if (s != NULL) {
   415 	if (s != NULL) {
   415 		*s = 0;
   416 		*s = 0;
   416 		chdir(exe);
   417 		chdir(exe);
   417 		*s = '/';
   418 		*s = '/';
   418 	}
   419 	}
   419 }
   420 }
       
   421 #endif
   420 
   422 
   421 void ShowInfo(const char *str)
   423 void ShowInfo(const char *str)
   422 {
   424 {
   423 	puts(str);
   425 	puts(str);
   424 }
   426 }
   437 }
   439 }
   438 
   440 
   439 int CDECL main(int argc, char* argv[])
   441 int CDECL main(int argc, char* argv[])
   440 {
   442 {
   441 	// change the working directory to enable doubleclicking in UIs
   443 	// change the working directory to enable doubleclicking in UIs
   442 #if defined(__BEOS__)
   444 #if defined(__BEOS__) || defined(__linux__)
   443 	ChangeWorkingDirectory(argv[0]);
       
   444 #endif
       
   445 #if defined(__linux__)
       
   446 	ChangeWorkingDirectory(argv[0]);
   445 	ChangeWorkingDirectory(argv[0]);
   447 #endif
   446 #endif
   448 
   447 
   449 	_random_seeds[0][1] = _random_seeds[0][0] = time(NULL);
   448 	_random_seeds[0][1] = _random_seeds[0][0] = time(NULL);
   450 
   449