Giter Club home page Giter Club logo

Comments (5)

Julian avatar Julian commented on June 22, 2024

Thanks. Do you happen to see what the fix should look like here? A PR would certainly be welcome given you've got a device you can try it on.

from platformdirs.

nukemiko avatar nukemiko commented on June 22, 2024

Thanks. Do you happen to see what the fix should look like here? A PR would certainly be welcome given you've got a device you can try it on.

I found codes for OS detection in src/platformdirs/__init__.py:

if os.getenv("ANDROID_DATA") == "/data" and os.getenv("ANDROID_ROOT") == "/system":
    module, name = "platformdirs.android", "Android"

A temporary mitigation for this problem is unset environment valriable ANDROID_ROOT and ANDROID_DATA.

In order to fix this problem, the following judgment conditions may be more appropriate:

if os.getenv("ANDROID_DATA") == "/data" and os.getenv("ANDROID_ROOT") == "/system" and not (os.path.exists("/usr") or os.path.exists("/run")):
    module, name = "platformdirs.android", "Android"

from platformdirs.

Julian avatar Julian commented on June 22, 2024

That sounds odd to me (but I'll have to read the code more carefully).

Termux is Android, so I'd expect a fix to look like making the Android module know how to cope with it, rather than marking it as not-Android. But that's just an initial reaction.

from platformdirs.

YariKartoshe4ka avatar YariKartoshe4ka commented on June 22, 2024

I can clarify: these variables are written in the init.environ.rc file in the device's skin, so wherever the shell is launched (even from the subsystem), they will be present everywhere. I was counting only on applications, Python IDEs and Termux, but not subsystems.

I think the best solution would be, before choosing android, to check if it is possible to get a folder from _android_folder and, if possible, then choose android, otherwise other OS (windows, macos, linux). I will open PR as soon as possible

from platformdirs.

gaborbernat avatar gaborbernat commented on June 22, 2024

Fixed via #63.

from platformdirs.

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.