Skip to content

Commit 5659858

Browse files
committed
Bug fix to use with abspath and relpath
1 parent 23d0c41 commit 5659858

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/fosslight_reuse/_add.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def set_missing_license_copyright(missing_license_filtered, missing_copyright_fi
116116
logger.info("# Missing license File(s) ")
117117
for lic_file in sorted(missing_license_filtered):
118118
logger.info(f" * {lic_file}")
119-
missing_license_list.append(path_to_find + '/' + lic_file)
119+
missing_license_list.append(lic_file)
120120

121121
if license == "" and copyright == "":
122122
input_license = input_license_while_running()
@@ -140,7 +140,7 @@ def set_missing_license_copyright(missing_license_filtered, missing_copyright_fi
140140
logger.info("# Missing Copyright File(s) ")
141141
for cop_file in sorted(missing_copyright_filtered):
142142
logger.info(f" * {cop_file}")
143-
missing_copyright_list.append(os.getcwd() + '/' + path_to_find + '/' + cop_file)
143+
missing_copyright_list.append(cop_file)
144144

145145
if license == "" and copyright == "":
146146
input_copyright = input_copyright_while_running()
@@ -195,6 +195,12 @@ def add_content(path_to_find, file, input_license="", input_copyright=""):
195195

196196
if path_to_find == "":
197197
path_to_find = os.getcwd()
198+
else:
199+
path_to_find = os.path.abspath(path_to_find)
200+
201+
os.chdir(path_to_find)
202+
if not path_to_find.endswith("/"):
203+
path_to_find += "/"
198204

199205
now = datetime.now().strftime('%Y%m%d_%H-%M-%S')
200206
output_dir = os.getcwd()

0 commit comments

Comments
 (0)