Giter Site home page Giter Site logo

Symlinks are dereferenced about dragon HOT 9 CLOSED

mwh avatar mwh commented on August 15, 2024
Symlinks are dereferenced

from dragon.

Comments (9)

mwh avatar mwh commented on August 15, 2024 1

Yeah, this works for me in the tests I’ve thrown at it. It’s merged in now.

There is a trade-off here: if you use it for actual file manipulation (e.g. drag into a file manager), it’s going to copy the symlink and not the file, which isn’t very useful. Dragging to a browser or something is probably the more common use case so I’ve merged it, but I might add a --follow-symlinks option or something for the other case.

from dragon.

mwh avatar mwh commented on August 15, 2024

This is the behaviour I would expect, though there's a case for it to be an option. Moving a fixed symlink about isn't terribly useful.

from dragon.

protist avatar protist commented on August 15, 2024

I came across this when I was trying to upload some files. I had the original files scattered around my filesystem, and I had collated them into another directory using symlinks, concurrently giving them appropriate filenames. I dragged the symlinks into my browser, which uploaded the data fine, as expected, but the names were all wrong.

Another usage case where this might be a problem is if you were to embed an image into another file. I often embed a symlinked raster image into, say, Inkscape. If I then need to modify the original file, I just change the symlink to point at the new, modified file. Similarly so when I reference images in LyX/LaTeX.

In general, I can't think of a case where I'd want it deferenced, or if there's any advantage to do so, but perhaps that's just my usage though.

from dragon.

eigengrau avatar eigengrau commented on August 15, 2024

I also would also have expected path names to be left unchanged. Since the interface is CL, users who want the path normalized in some way can easily throw in a realpath etc. invocation themselves.

from dragon.

eigengrau avatar eigengrau commented on August 15, 2024

Okay, since this may be passed as a URI it must be at least absolute. I’d recon the least surprising way to achieve this would be to prepend the CWD and canonicalize without resolving symlinks.

from dragon.

eigengrau avatar eigengrau commented on August 15, 2024

Fixing #2 also fixes this, since GIO will canonicalize the path, but will leave symlinks untouched.

from dragon.

protist avatar protist commented on August 15, 2024

@eigengrau Your commit partially works. I can click on b, and now dragon leaves the symlink untouched, which is great. However, when I try to drag b, dragon still outputs a instead.

from dragon.

eigengrau avatar eigengrau commented on August 15, 2024

@protist I cannot reproduce this yet. Did you accidentally run your globally installed build of dragon instead of the binary built from git, by any chance?

When I run this (from 7716c30):

touch a
ln -s a b
./dragon --verbose a b

Dragging b into a dragon --target will print:

Writing as URI: file:///home/seb/dev/c/dragon/b

And the --target instance also receives this URL.

from dragon.

protist avatar protist commented on August 15, 2024

Oops, apologies. I was testing by dragging into a program that automatically dereferenced the symlink. I can confirm that your code works perfectly! Thank you!

from dragon.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.