mirror of
https://github.com/fltk/fltk.git
synced 2026-06-04 06:56:24 +08:00
Clean up fl_args for OS X.
Xcode and OS X have the annoying habit of adding the process number and debug information on the command line if an an app is inside a bundle. This is a little cleanup that I thought was useful while going through the code. A better solution would be to remove those system specific arguments from the argc/argv list entirely, as they appear totally unexpected for most developers. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11111 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
+9
-8
@@ -175,19 +175,14 @@ int Fl::arg(int argc, char **argv, int &i) {
|
|||||||
Fl_Tooltip::disable();
|
Fl_Tooltip::disable();
|
||||||
i++;
|
i++;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
// The Finder application in MacOS X passes the "-psn_N_NNNNN" option
|
// The Finder application in MacOS X passes the "-psn_N_NNNNN" option
|
||||||
// to all apps...
|
// to all apps...
|
||||||
else if (strcmp(s, "NSDocumentRevisionsDebugMode") == 0) {
|
|
||||||
i++;
|
|
||||||
if (argv[i]) i++;
|
|
||||||
return 1;
|
|
||||||
} else if (strncmp(s, "psn_", 4) == 0) {
|
} else if (strncmp(s, "psn_", 4) == 0) {
|
||||||
i++;
|
i++;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
|
||||||
#endif // __APPLE__
|
#endif // __APPLE__
|
||||||
|
}
|
||||||
|
|
||||||
const char *v = argv[i+1];
|
const char *v = argv[i+1];
|
||||||
if (i >= argc-1 || !v)
|
if (i >= argc-1 || !v)
|
||||||
@@ -205,6 +200,12 @@ int Fl::arg(int argc, char **argv, int &i) {
|
|||||||
Fl::display(v);
|
Fl::display(v);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __APPLE__
|
||||||
|
// Xcode in MacOS X may pass "-NSDocumentRevisionsDebugMode YES"
|
||||||
|
} else if (strcmp(s, "NSDocumentRevisionsDebugMode") == 0) {
|
||||||
|
// nothing to do
|
||||||
|
#endif // __APPLE__
|
||||||
|
|
||||||
} else if (fl_match(s, "title", 2)) {
|
} else if (fl_match(s, "title", 2)) {
|
||||||
title = v;
|
title = v;
|
||||||
|
|
||||||
|
|||||||
@@ -724,6 +724,7 @@ int fl_stat(const char* f, struct stat *b) {
|
|||||||
|
|
||||||
} // fl_stat()
|
} // fl_stat()
|
||||||
|
|
||||||
|
// TODO: add fl_chdir if we have fl_getcwd
|
||||||
|
|
||||||
/** Cross-platform function to get the current working directory
|
/** Cross-platform function to get the current working directory
|
||||||
as a UTF-8 encoded value.
|
as a UTF-8 encoded value.
|
||||||
|
|||||||
@@ -106,8 +106,11 @@ main(int argc, // I - Number of command-line arguments
|
|||||||
int argn = 1;
|
int argn = 1;
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
// OS X may add the process number as the first argument - ignore
|
// OS X may add the process number as the first argument - ignore
|
||||||
|
// FIXME: Fl::args() should remove the Apple specific arguments form argc and argv
|
||||||
if (argc>argn && strncmp(argv[1], "-psn_", 5)==0)
|
if (argc>argn && strncmp(argv[1], "-psn_", 5)==0)
|
||||||
argn++;
|
argn++;
|
||||||
|
if (argc>argn+1 && strcmp(argv[argn], "-NSDocumentRevisionsDebugMode") == 0)
|
||||||
|
argn+=2;
|
||||||
#endif
|
#endif
|
||||||
if (argc > argn)
|
if (argc > argn)
|
||||||
filter->value(argv[argn]);
|
filter->value(argv[argn]);
|
||||||
|
|||||||
Reference in New Issue
Block a user