xaizek / vifm (License: GPLv2+) (since 2018-12-07)
Vifm is a file manager with curses interface, which provides Vi[m]-like environment for managing objects within file systems, extended with some useful ideas from mutt.
Commit ff953304cd9097af23dbee2feab710a4c273f655

packer: apply fixes to make it work on Windows
Slashes and escaping were getting in the way.
Author: xaizek
Author date (UTC): 2024-03-11 17:35
Committer name: xaizek
Committer date (UTC): 2024-03-11 17:38
Parent(s): 3f6d5be3c997ba3f64a7497e6da95443d6a48151
Signing key: 99DC5E4DB05F6BE2
Tree: 8de9ea0d50f0e449ba1f5854c4f506839798e3f0
File Lines added Lines deleted
data/plugins/packer/README.md 1 1
data/plugins/packer/pack.lua 2 2
data/plugins/packer/unpack.lua 10 2
File data/plugins/packer/README.md changed (mode: 100644) (index 5a8f31010..ed74cb01a)
... ... Archives the selected files. Optionally takes archive name.
72 72
73 73 Operating systems: Operating systems:
74 74 - working under Linux environment (tested on Gentoo, Slackware) - working under Linux environment (tested on Gentoo, Slackware)
75 - not tested on Windows, please report if it doesn't work
75 - working in Windows
76 76
77 77 Limitations: Limitations:
78 78 - extracting large tarballs is slow due to `tar tf` being slow - extracting large tarballs is slow due to `tar tf` being slow
File data/plugins/packer/pack.lua changed (mode: 100644) (index 990562caf..6d92955a1)
1 1 function pack(info) -- <<< function pack(info) -- <<<
2 local files = vifm.expand('%f')
2 local files = vifm.expand('%"f')
3 3 if #files == 0 or if #files == 0 or
4 4 files == '.' or files == './' or files == '.' or files == './' or
5 5 files == '..' or files == '../' then files == '..' or files == '../' then
 
... ... function pack(info) -- <<<
16 16 ext = 'tar.'..ext ext = 'tar.'..ext
17 17 end end
18 18 else else
19 local singlefile = (vifm.expand('%c') == files)
19 local singlefile = (vifm.expand('%"c') == files)
20 20 local basename = singlefile and vifm.expand('%c:r:r') or vifm.expand('%d:t') local basename = singlefile and vifm.expand('%c:r:r') or vifm.expand('%d:t')
21 21 outfile = string.format("%s.%s", unescape_name(basename), ext) outfile = string.format("%s.%s", unescape_name(basename), ext)
22 22 end end
File data/plugins/packer/unpack.lua changed (mode: 100644) (index 9e3419ca9..77108b42c)
... ... local function get_common_unpack_prefix(archive, format) -- <<<
7 7 -- when large archives or archives with lots of files -- when large archives or archives with lots of files
8 8 cmd = string.format("tar --force-local -tf %s", vifm.escape(archive)) cmd = string.format("tar --force-local -tf %s", vifm.escape(archive))
9 9 elseif format == 'zip' or format == 'rar' or format == '7z' then elseif format == 'zip' or format == 'rar' or format == '7z' then
10 cmd = string.format("7z -ba l %s | awk '{($3 ~ /^D/) ? $0=$0\"/\" : $0; print substr($0,54) }'",
11 vifm.escape(archive))
10 cmd = string.format("7z -ba l %s | awk %s",
11 vifm.escape(archive),
12 vifm.escape('{($3 ~ /^D/) ? $0=$0"/" : $0; print substr($0,54) }'))
12 13 else else
13 14 return nil, 'unsupported format: '..format return nil, 'unsupported format: '..format
14 15 end end
 
... ... local function get_common_unpack_prefix(archive, format) -- <<<
17 18 local prefix local prefix
18 19 local prefix_len local prefix_len
19 20 for line in job:stdout():lines() do for line in job:stdout():lines() do
21 -- this conversion is really just for Windows, but there is currently no
22 -- way of checking whether we're running on Windows
23 --
24 -- Unix systems can allow slashes in file names in which case we might end
25 -- up computing incorrect prefix, but it's a highly unlikely corner case
26 line = line:gsub('\\', '/')
27
20 28 vifm.sb.quick("Checking: "..line) vifm.sb.quick("Checking: "..line)
21 29 if prefix == nil then if prefix == nil then
22 30 prefix = line prefix = line
Hints

Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://code.reversed.top/user/xaizek/vifm

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@code.reversed.top/user/xaizek/vifm

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a pull request:
... clone the repository ...
... make some changes and some commits ...
git push origin master