summaryrefslogtreecommitdiffstats
path: root/main.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2013-01-24 20:01:18 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-01-24 20:01:18 -0800
commit29ae8cb13131164dcc114458c81bf737de1de469 (patch)
tree17bf268d31ae44befa1aa6152412e5679b9ca138 /main.c
parent7c26432186aff3fdadfb5f6f06da58b47b90d70c (diff)
downloadsubsurface-29ae8cb13131164dcc114458c81bf737de1de469.tar.gz
Don't set a default filename when called with multiple filenames
The behavior is just too illogical - it's too easy to unintentionally overwrite a file this way. The default filename is set if we have exactly one filename on the command line or if we we open the default file. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'main.c')
-rw-r--r--main.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/main.c b/main.c
index 44e814a19..ebb33c440 100644
--- a/main.c
+++ b/main.c
@@ -335,10 +335,12 @@ int main(int argc, char **argv)
parse_argument(a);
continue;
}
- no_filenames = FALSE;
GError *error = NULL;
- parse_file(a, &error, TRUE);
-
+ /* if we have exactly one filename, parse_file will set
+ * that to be the default. Otherwise there will be no default filename */
+ set_filename(NULL, TRUE);
+ parse_file(a, &error, no_filenames);
+ no_filenames = FALSE;
if (error != NULL)
{
report_error(error);