Browse code
feat: update linkify
fiddlerwoaroof authored on 28/11/2020 07:34:53
Showing 1 changed files
Showing 1 changed files
... | ... |
@@ -49,11 +49,24 @@ linkify_tree() { |
49 | 49 |
cd "$1" |
50 | 50 |
find . -type f | { |
51 | 51 |
while read -r fn; do |
52 |
+ target="$(file_to_hashed_dir "$fn")" |
|
52 | 53 |
if ! [[ -L "$fn" ]]; then |
53 |
- target="$(file_to_hashed_dir "$fn")" |
|
54 |
- cp "$fn" "$target" |
|
55 |
- rm "$fn" |
|
56 |
- ln -sv "$target" "$fn" |
|
54 |
+ if ! [[ -f "$target" ]]; then |
|
55 |
+ if [[ -e "$target" ]]; then |
|
56 |
+ echo $target is not a normal file |
|
57 |
+ ls -l "$target" |
|
58 |
+ exit 1 |
|
59 |
+ fi |
|
60 |
+ mv "$fn" "$target" |
|
61 |
+ else |
|
62 |
+ mv "$fn" "$fn".old |
|
63 |
+ fi |
|
64 |
+ ln -v "$target" "$fn" |
|
65 |
+ if [[ -f "$fn".old ]]; then |
|
66 |
+ rm "$fn".old |
|
67 |
+ fi |
|
68 |
+ else |
|
69 |
+ touch $target |
|
57 | 70 |
fi |
58 | 71 |
echo |
59 | 72 |
done |