Browse Source

Resolve ~ (HOME) at chdir prompt

master
Arun Prakash Jana 7 years ago
parent
commit
b7e4968a48
No known key found for this signature in database GPG Key ID: A75979F35C080412
2 changed files with 13 additions and 3 deletions
  1. +2
    -2
      config.def.h
  2. +11
    -1
      nnn.c

+ 2
- 2
config.def.h View File

@@ -12,9 +12,9 @@ static char *idlecmd = "rain"; /* The screensaver program */

struct assoc assocs[] = {
{ "\\.(c|cpp|h|txt|log|sh)$", "vi" },
//{ "\\.(avi|mp4|mkv|3gp|mov)$", "mpv" },
{ "\\.(avi|mp4|mkv|3gp|mov)$", "mpv" },
{ "\\.(wma|mp3|ogg|flac|m4a)$", "mpv" },
//{ "\\.(png|jpg|gif)$", "feh" },
{ "\\.(png|jpg|gif)$", "viewnior" },
//{ "\\.(html|svg)$", "firefox" },
{ "\\.pdf$", "zathura" },
//{ "\\.sh$", "sh" },


+ 11
- 1
nnn.c View File

@@ -1247,7 +1247,17 @@ nochange:
clearprompt();
goto nochange;
}
mkpath(path, tmp, newpath, sizeof(newpath));

if (tmp[0] == '~') {
char *home = getenv("HOME");
if (home)
snprintf(newpath, PATH_MAX,
"%s%s", home, tmp + 1);
else
mkpath(path, tmp, newpath, sizeof(newpath));
} else
mkpath(path, tmp, newpath, sizeof(newpath));

if (canopendir(newpath) == 0) {
printwarn();
goto nochange;


Loading…
Cancel
Save