Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix relative "shortcuts" in Windows #249

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Maczuga
Copy link

@Maczuga Maczuga commented Sep 29, 2023

Apparently there is no support for relative shortcuts in Windows. Use symlinks instead thus fixing the relative paths.

Fixes #248

Apparently there is no support for relative shortcuts in Windows. Use symlinks instead thus fixing the relative paths.
@Maczuga
Copy link
Author

Maczuga commented Sep 29, 2023

Actually - is there a reason why we need the platform specific commands here?
I have just tested running simply like that:

Future<File> createShortcut(Directory location, File target) async {
  final name = p.basename(target.path);
  final link = findNotExistingName(File(p.join(location.path, name)));
  // this must be relative to not break when user moves whole folder around:
  // https://github.com/TheLastGimbus/GooglePhotosTakeoutHelper/issues/232
  final targetRelativePath = p.relative(target.path, from: link.parent.path);
  return File((await Link(link.path).create(targetRelativePath)).path);
}

12821/12821 files, no errors, all symlinks are relative, Windows 10 x64.

@TheLastGimbus
Copy link
Owner

siema maczuga

sluchaj pytanko, czy jak sie tworzy takie symlinki na windozie to to ładnie działa, wszystko jest widać w plikach/na pulpit to można dać? jeśli tak to możemy na nie totalnie przejść

jeśli by sie okazało że on jak sie kopiuje np na FATa to to zamienia na fatowe symlinki itp, to jeszcze zajebiściej

@Maczuga
Copy link
Author

Maczuga commented Sep 30, 2023

Na szybko sprawdziłem to co mam teraz - symlinki generowałem właśnie #249 (comment)

Jak dałem ctrl+x -> v (wytnij/przenieś) na 2 katalogi - powiedzmy Album1 i ALL_PHOTOS z folderu Takeout np. na root dysku - to relatywność mi się zachowała - i mogłem symlinkami wchodzić dalej w oryginały zdjęć (w folderze TakeoutOut - tam gdzie skrypt puścił output - nie było już ALL_PHOTOS, więc symlink poprawnie kierował na powiedzmy E:/ALL_PHOTOS zamiast E:/TakeoutOut/ALL_PHOTOS).

Za to kopiowanie symlinków w tym przypadku (za pomocą explorera) - w miejscu docelowym pojawiały się już nie symlinki - a były one zastąpione gotowym plikiem.

Jutro spróbuję jakiś mniejszy repro-case zrobić, bo na 130GB danych średnio się kopiuje/testuje.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Invalid symlinks on Windows
2 participants