8
8
EURO = [
9
9
"b9f4175382a404007e19d3566061e36c" ,
10
10
"9076ddd6ddf0bffc24e6ac71c1353d33" ,
11
- "1d7fb4e154e7198dfb39d16d9800844d"
11
+ "1d7fb4e154e7198dfb39d16d9800844d" ,
12
12
]
13
13
14
+
14
15
def main ():
15
16
# Gets the full path of the www/l directory.
16
- path = Path ().resolve ().parent .joinpath ("www" , "l" )
17
+ path = (
18
+ Path (os .path .dirname (os .path .abspath (__file__ )))
19
+ .resolve ()
20
+ .parent .joinpath ("www" , "l" )
21
+ )
22
+ # Check if the directory is exists.
23
+ if not os .path .exists (str (path )):
24
+ raise Exception ("The www/l folder doesn't exists!" )
17
25
# Stores the original files
18
26
original_files = {}
19
27
for root , dirs , files in os .walk (path ):
@@ -42,7 +50,11 @@ def main():
42
50
# by-nc/1.0/80x15.png --> by-nc - first
43
51
# x 1.0
44
52
# --> 80x15.png - last
45
- parent = Path (path ).joinpath (os .path .join (Path (relative ).parts [0 ], Path (relative ).parts [- 1 ]))
53
+ parent = Path (path ).joinpath (
54
+ os .path .join (
55
+ Path (relative ).parts [0 ], Path (relative ).parts [- 1 ]
56
+ )
57
+ )
46
58
47
59
# If the file contains an euro symbol, add -e tag to the end of file
48
60
# to avoid the overwriting.
@@ -63,13 +75,13 @@ def main():
63
75
# Will be deleted and replaced with symbolic link
64
76
# that points to "by-nc/80x15.png"
65
77
if str (parent ) != str (f ):
66
- symlinks = [ str (f ) ]
78
+ symlinks = [str (f )]
67
79
if not os .path .exists (str (parent )):
68
80
copyfile (str (f ), str (parent ))
69
81
70
82
original_files [digest ] = {
71
83
"base" : str (parent ),
72
- "symlinks" : symlinks
84
+ "symlinks" : symlinks ,
73
85
}
74
86
# Start deleting the duplicated files and create
75
87
# symbolic links instead.
0 commit comments