Giter Club home page Giter Club logo

Comments (3)

Kontrabant avatar Kontrabant commented on September 13, 2024

Sure, it can be elevated out of the *nix code if needed.

from sdl.

Kontrabant avatar Kontrabant commented on September 13, 2024

Can Windows actually return local paths with a hostname in them? It would be much simpler to just #ifdef that bit out vs wiring up and starting the whole socket system on Windows just for this.

from sdl.

Dragon-Baroque avatar Dragon-Baroque commented on September 13, 2024

If I understand, SDL_URIToLocal takes an URI and checks whether it names a local file, returns the path to that file if yes.

The URI can be file:/localPath or localPath, file:///localPath or //localPath where localPath does not start with /.
In all these cases, the is local condition is satisfied and SDL_URIToLocal returns the localPath amended of its %hh.

When the URI is file://remoteHost/remotePath or /remoteHost/remotePath, then SDL_URIToLocal obtains the local hostname and compares it with remoteHost, if equal then uses remotePath as localPath earlier, otherwise rejects the file as non local.

I find the string comparison of the local hostname and the remoteHost rather strange because there are many aliases for the local hostname : localhost, localhost.localdomain and their IPV4 and IPV6 variants, explicit IP 127.0.0.1 or ::1, for which the comparison would fail even though remoteHost is actually the local host.

Could we place at least a comparison to localhost, possibly to 127.0.0.1, and in Windows, stop there, and in Unix leave the comparison to the gethostname ? SDL 3 on Windows would no longer depend on the Windows Socket stack.

Actually, to answer your question, I should point out that I added text/uri-list to allow application to application file Drag and Drop, for those applications that did not want to or could not build a CF_HDROP clipboard in the Windows case.
This was the case in Exult, were the Game engine ran using SDL 2 and the Drag and Drop file sender ran using GTK+.

from sdl.

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.