suckit icon indicating copy to clipboard operation
suckit copied to clipboard

Create cross platform symlinks

Open CohenArthur opened this issue 6 years ago • 10 comments

https://github.com/Skallwar/suckit/blob/5233aecbc15adcb08f72be93e5347eaf72621079/src/disk.rs#L40

Use cross platform symlink creation instead of std::os::unix::fs

CohenArthur avatar Apr 30 '20 09:04 CohenArthur

destination will always be a directory, right?

SpyrosRoum avatar May 06 '20 15:05 SpyrosRoum

destination will always be a directory, right?

No, a file

Skallwar avatar May 06 '20 15:05 Skallwar

Hm to be honest I am not really sure I get why you need to create symlinks at all but assuming it's always for a file, I can do that with windows::os::fs::symlink_file

SpyrosRoum avatar May 06 '20 16:05 SpyrosRoum

Hm to be honest I am not really sure I get why you need to create symlinks at all but

Sometime we discover a link wich is a pdf (eg. test.org/pdf/test.pdf). So a page wich contain a link to this file will replace every test.org/pdf/test.pdf by test_org_pdf_test_pdf. But the real name of this pdf (test.pdf) is only found when actualy processing the url (test.org/pdf/test.pdf). At this point we save the pdf to it's real filename and create a symlink between test.pdf and test_org_pdf_test_pdf

I can do that with windows::os::fs::symlink_file

Should be this one indeed

Skallwar avatar May 06 '20 16:05 Skallwar

If you know of a url that needs this I can try to do it. Is that the only reason why it doesn't work in windows?

SpyrosRoum avatar May 06 '20 22:05 SpyrosRoum

We think it's the only reason but haven't tried. There might be more to it. If you have a windows build available, feel free to try. I'll add it to the CI as well

CohenArthur avatar May 06 '20 22:05 CohenArthur

I have a vm I can use but from what I understand it doesn't happen with every page you try to download, right?

SpyrosRoum avatar May 06 '20 22:05 SpyrosRoum

True, symlinks aren't always created. The code calling disk::symlink() is here

CohenArthur avatar May 06 '20 22:05 CohenArthur

I know, I am asking if you already know of a page that requires symlinks so I can easily test it

SpyrosRoum avatar May 06 '20 22:05 SpyrosRoum

Oh my bad, sorry about the confusion. Any page downloading PDFs basically, so a page like https://dl.acm.org/doi/book/10.1145/3368274 is good.

CohenArthur avatar May 06 '20 22:05 CohenArthur