Skip to content

Commit

Permalink
Uses correct environment variable for Win32, USERPROFILE vs *nix HOME.
Browse files Browse the repository at this point in the history
  • Loading branch information
tplunket committed May 26, 2016
1 parent 6ee784f commit fc4851b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/options.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ const char *color_match = "\033[30;43m"; /* black with yellow background */
const char *color_path = "\033[1;32m"; /* bold green */
#define BUFFER_SIZE 4096

#ifdef _MSC_VER
#define HOME_VAR "USERPROFILE"
#else
#define HOME_VAR "HOME"
#endif

#ifdef _MSC_VER
/* Unlike popen(), it doesn't pollutes stderr if the executable doesn't exist.
This might be common on Windows (no git installed)
Expand Down Expand Up @@ -279,7 +285,7 @@ void parse_options(int argc, char **argv, char **base_paths[], char **paths[]) {
int list_file_types = 0;
int opt_index = 0;
char *num_end;
const char *home_dir = getenv("HOME");
const char *home_dir = getenv(HOME_VAR);
char *ignore_file_path = NULL;
int accepts_query = 1;
int needs_query = 1;
Expand Down

0 comments on commit fc4851b

Please sign in to comment.