]> sigrok.org Git - pulseview.git/commitdiff
Restore the default of "pulseview foo.sr" opening the file.
authorUwe Hermann <redacted>
Fri, 21 Aug 2015 13:23:58 +0000 (15:23 +0200)
committerUwe Hermann <redacted>
Fri, 21 Aug 2015 15:14:12 +0000 (17:14 +0200)
This used to work in e.g. the 0.2.0 release and is much more convenient
than having to supply "-i" for every file. It also allows for (easier, at
least) association of the .sr extension with PulseView on most OSes.

main.cpp

index 623972395c6c91e61b1d0dfe62590f83ba8a502f..97a61280ac5bc0462dc2da35d179ecd129a54ecf 100644 (file)
--- a/main.cpp
+++ b/main.cpp
@@ -128,9 +128,11 @@ int main(int argc, char *argv[])
                }
        }
 
                }
        }
 
-       if (argc != optind) {
-               fprintf(stderr, "Unexpected argument: %s\n", argv[optind]);
+       if (argc - optind > 1) {
+               fprintf(stderr, "Only one file can be openened.\n");
                return 1;
                return 1;
+       } else if (argc - optind == 1) {
+               open_file = argv[argc - 1];
        }
 
        // Initialise libsigrok
        }
 
        // Initialise libsigrok