fned 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/fned/filename_edit.rb +11 -4
- data/lib/fned/version.rb +1 -1
- metadata +2 -2
data/lib/fned/filename_edit.rb
CHANGED
@@ -74,12 +74,22 @@ module Fned
|
|
74
74
|
}.merge(options)
|
75
75
|
|
76
76
|
if @options[:recursive]
|
77
|
-
@paths = @paths.map { |path| walk(path) }.flatten
|
77
|
+
@paths = @paths.map { |path| [path] + walk(path) }.flatten
|
78
78
|
end
|
79
79
|
|
80
|
+
# Ensure all paths are in binary encoding, otherwise comparison
|
81
|
+
# wont work after reading the files back from the file.
|
82
|
+
@paths.map! { |path| Pathname.new(path.to_s.force_encoding("binary")) }
|
83
|
+
# Don't display the same path multiple times.
|
84
|
+
@paths.uniq!
|
85
|
+
# It is not possible to rename `.' and `..'.
|
86
|
+
@paths.reject! { |path| %w(. ..).include?(path.basename.to_s) }
|
87
|
+
|
80
88
|
@errors = []
|
81
89
|
end
|
82
90
|
|
91
|
+
# Recursively walk through path and return path of all entries.
|
92
|
+
# Does not include path itself.
|
83
93
|
def walk(path)
|
84
94
|
# TODO: descend into symlinked directories?
|
85
95
|
# TODO: handle errors (ENOENT, ENOTDIR, ELOOP, EACCESS)
|
@@ -98,9 +108,6 @@ module Fned
|
|
98
108
|
end
|
99
109
|
|
100
110
|
result = []
|
101
|
-
unless %w(. ..).include?(path.basename.to_s)
|
102
|
-
result << path
|
103
|
-
end
|
104
111
|
result += entries
|
105
112
|
result += entries.map do |entry|
|
106
113
|
if entry.lstat.directory?
|
data/lib/fned/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fned
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-01-
|
12
|
+
date: 2012-01-30 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: fned allows you to use your favorite $EDITOR to edit filenames
|
15
15
|
email: matled@gmx.net
|