diff options
| author | Maxime Coste <mawww@kakoune.org> | 2018-03-23 08:22:34 +1100 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2018-03-23 08:22:34 +1100 |
| commit | a732037b539db23010fcb379d643159670e05960 (patch) | |
| tree | e0bd8f7a579310e86572858e12e5a3379a70fb31 /src/file.hh | |
| parent | 42404ddb3a6822fd5777e7d2582b2fe74b43c48b (diff) | |
Support `%` in `path` option to mean current buffer directory
In the end, % is not that painful to work with as its only set seldomly,
and we usually dont need to use expansion at the same time. Moreover, it
just requires a single \ to be escaped.
Fixes #1562
Diffstat (limited to 'src/file.hh')
| -rw-r--r-- | src/file.hh | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/file.hh b/src/file.hh index 232ff539..5986ab2f 100644 --- a/src/file.hh +++ b/src/file.hh @@ -19,8 +19,10 @@ class Regex; using CandidateList = Vector<String, MemoryDomain::Completion>; -// parse ~/ and $env values in filename and returns the translated filename +// parse ~/ and %/ in filename and returns the translated filename +String parse_filename(StringView filename, StringView buf_dir); String parse_filename(StringView filename); + String real_path(StringView filename); String compact_path(StringView filename); @@ -54,7 +56,7 @@ void write_buffer_to_file(Buffer& buffer, StringView filename, bool force = fals void write_buffer_to_fd(Buffer& buffer, int fd); void write_buffer_to_backup_file(Buffer& buffer); -String find_file(StringView filename, ConstArrayView<String> paths); +String find_file(StringView filename, StringView buf_dir, ConstArrayView<String> paths); bool file_exists(StringView filename); Vector<String> list_files(StringView directory); |
