summaryrefslogtreecommitdiff
path: root/test/browser.cxx
diff options
context:
space:
mode:
authorAlbrecht Schlosser <albrechts.fltk@online.de>2020-08-21 18:54:40 +0200
committerAlbrecht Schlosser <albrechts.fltk@online.de>2020-08-21 18:54:40 +0200
commitd91160a9e06bd4ee341ca93509dbce9393d9168a (patch)
tree5fa6e3fb9483ce06f39ba638790eb58d81c13129 /test/browser.cxx
parentf3005a44f87e30792acc410125113cd19b76a81a (diff)
Remove platform specific code from test apps
Test programs that open files don't use platform specific code. They don't open files from macOS bundles. Support files must either be in the current working directory or given on the command line. On macOS this requires a full path when using bundles.
Diffstat (limited to 'test/browser.cxx')
-rw-r--r--test/browser.cxx39
1 files changed, 6 insertions, 33 deletions
diff --git a/test/browser.cxx b/test/browser.cxx
index 23d84e7d8..05c83acb2 100644
--- a/test/browser.cxx
+++ b/test/browser.cxx
@@ -160,42 +160,15 @@ void wtype_cb(Fl_Widget *, void *) {
int main(int argc, char **argv) {
int i;
- if (!Fl::args(argc,argv,i)) Fl::fatal(Fl::help);
- const char* fname = (i < argc) ? argv[i] : "browser.cxx";
- Fl_Double_Window window(720,520,fname);
- browser = new Fl_Select_Browser(0,0,window.w(),350,0);
+ if (!Fl::args(argc, argv, i)) Fl::fatal(Fl::help);
+ const char *fname = (i < argc) ? argv[i] : "browser.cxx";
+ Fl_Double_Window window(720, 520, fname);
+ browser = new Fl_Select_Browser(0, 0, window.w(), 350, 0);
browser->type(FL_MULTI_BROWSER);
- //browser->type(FL_HOLD_BROWSER);
- //browser->color(42);
browser->callback(b_cb);
- // browser->scrollbar_right();
- //browser->has_scrollbar(Fl_Browser::BOTH_ALWAYS);
- //browser->format_char('#');
if (!browser->load(fname)) {
- int done = 0;
-#ifdef _MSC_VER
- // if 'browser' was started from the VisualC environment in Win32,
- // the current directory is set to the environment itself,
- // so we need to correct the browser file path
- if ( i == argc )
- {
- fname = "../test/browser.cxx";
- done = browser->load(fname);
- }
-#elif defined(__APPLE__)
- char buf[2048];
- strcpy(buf, argv[0]);
- char *slash = strrchr(buf, '/');
- if (slash) {
- strcpy(slash, "/../../../browser.cxx");
- }
- done = browser->load(buf);
-#endif
- if ( !done )
- {
- fl_message("Can't load %s, %s\n", fname, strerror(errno));
- exit(1);
- }
+ fl_message("Can't load '%s'\n%s\n", fname, strerror(errno));
+ exit(1);
}
browser->position(0);