Skip to content

Commit 9f7330d

Browse files
author
Hristo Gueorguiev
committed
Fix dir not existing on disperse, Temp. fix ident. files skip disperal (see TODO ID0)
1 parent dfac4d4 commit 9f7330d

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

dotgather.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
# - Fully test and re-enable disperse ✓
2222
# - Add README.MD with usage instructions ✓
2323
# - Add check in undo if exiting same as undo ✓
24-
# - Better indication when no changes to gathered files have occurred
24+
# - Better indication when no changes to gathered files have occurred (ID0)
2525
# - Maybe more granular disperse as option? Next ver. maybe
2626
# - Implement disperse diff-only? Next ver. maybe
2727

@@ -66,6 +66,7 @@ class GatherException(Exception):
6666

6767
# Util. funcs.
6868
def mkdir_or_existing(directory_path):
69+
print('Directory is:', directory_path)
6970
try:
7071
os.makedirs(directory_path)
7172
except FileExistsError:
@@ -291,9 +292,13 @@ def disperse_dotfiles(directory):
291292

292293
print_aligned(f'Source >> ', source_file_path, [('Target >> ', target_file_path)])
293294

294-
if not git_diff(source_file_path, target_file_path):
295-
print('These two files are the same, skipping dispersal. ♻️')
296-
continue
295+
print(target_file_path)
296+
297+
# TODO: (ID0)(Hristo)When dispersing to new machines this check was not working out and needs
298+
# to be fixed eventually for now doing the redundant work is fine
299+
# if not git_diff(source_file_path, target_file_path):
300+
# print('These two files are the same, skipping dispersal. ♻️')
301+
# continue
297302

298303
# Check if a file already exist in target location and backup for undo
299304
if target_exists:
@@ -315,6 +320,8 @@ def disperse_dotfiles(directory):
315320
print_center('Created undo for 💾')
316321

317322
# Copy repo dotfile to target location
323+
new_dir, _ = split_path_dir_file(target_file_path)
324+
mkdir_or_existing(new_dir)
318325
shutil.copy(source_file_path, target_file_path)
319326
files_dispersed += 1
320327
print('File dispersed. 🌱')

0 commit comments

Comments
 (0)