From 4007253649425ff37a503ea77cff2155ab9814ef Mon Sep 17 00:00:00 2001 From: Leo Tenenbaum Date: Wed, 3 Feb 2021 22:08:14 -0500 Subject: fixed command line argument with / in it windows --- main.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'main.c') diff --git a/main.c b/main.c index 894ed85..e6c7d74 100644 --- a/main.c +++ b/main.c @@ -1,5 +1,5 @@ // @TODO: -// - ensure buffer->filename never contains / on windows +// - popup to reload files and config on change // - split // - Windows installation #include "base.h" @@ -110,12 +110,18 @@ int main(int argc, char **argv) { switch (argc) { case 0: case 1: break; case 2: + // essentially, replace / with \ on windows. + for (char *p = argv[1]; *p; ++p) + if (strchr(ALL_PATH_SEPARATORS, *p)) + *p = PATH_SEPARATOR; starting_filename = argv[1]; break; default: fprintf(stderr, "Usage: %s [filename]\n", argv[0]); return EXIT_FAILURE; } + + SDL_SetHint(SDL_HINT_NO_SIGNAL_HANDLERS, "1"); // if this program is sent a SIGTERM/SIGINT, don't turn it into a quit event if (SDL_Init(SDL_INIT_VIDEO|SDL_INIT_TIMER) < 0) -- cgit v1.2.3