Wolfmyths / Myth-Mod-Manager

An easy way to swap and manage Payday 2 mods outside the game
https://modworkshop.net/mod/43276
MIT License
9 stars 4 forks source link

Use cross-platform startfile equivalent #24

Closed Sprixitite closed 10 months ago

Sprixitite commented 1 year ago

To fix one of the things limiting Linux compatibility as mentioned in #18

Wolfmyths commented 1 year ago

@Sprixitite So I went to check out sys.platform's possible return values and it seems like neither of those return values are there as seen here

https://docs.python.org/3.11/library/sys.html#sys.platform

I've never owned a Linux system so I don't understand how the command prompt can differ from using darwin or xdg-open

Check out os.uname() as well

https://docs.python.org/3.11/library/os.html#os.uname

Also one more thing, for consistency's sake, make a constant variable in constant_vars.py of the platform because we will probably use this variable across the program.

Sprixitite commented 1 year ago

The system.platform usage is valid, having both tested locally, and taken the time to double check I knew what was going on because it's written using some pythonic ternary operator I think is causing you (and initially caused me) some confusion

The code first checks if we're on win32, if so it uses os.startfile like before

If not it then checks if we're on apple ("Darwin"), and if so it sets the "opener" variable to "open" (I don't use apple products but apparently this command line API does what we want), if we're not on apple, it assumes we're on a Linux distro which supports X11 APIs, and assigns "opener" to "xdg-open", the correct command line API for linux

I'm currently about to go to bed, so I can rectify the issue with constants when I get time tomorrow, but the file open dialogue should work fine

(P.S: This is why I hate pythons syntax, it causes confusion like this)

Sprixitite commented 1 year ago

I'm aware apple support is unnecessary ATM, but it's practically free and could come in useful later if you decide to use this for Mac supported games

Wolfmyths commented 1 year ago

I knew what was going on because it's written using some pythonic ternary operator I think is causing you (and initially caused me) some confusion

Ooh yeah I see now, sorry about that.

I can rectify the issue with constants when I get time tomorrow

Making an actual constant in Python is way more work than it needs to be so just make it a variable in capital letters in the file like the rest of the constants.

(Even if we went going through the work, it's probably still not a true constant)

(P.S: This is why I hate pythons syntax, it causes confusion like this)

Yeah it really is a pain I'm trying to branch into the C family and some Lua but for now Python is working wonders for how fast I was able to build this program. With the framework being used it's a C++ wrapper for Python so I'm not losing on performance either.

I love C# so far but I had trouble making a mobile app with the .NET Maui framework it was a struggle the whole time and I think it was because of the framework. It has a mixed perception online from what it seems.

Sprixitite commented 1 year ago

Sorry for leaving this open for so long, life's been getting in the way and between forgetting I opened this PR and everything else I've not found the time to do anything I've mentioned, I'll try and get this moved along at some point ASAP, thanks for your patience

Wolfmyths commented 1 year ago

It's okay! Things happen.

Wolfmyths commented 10 months ago

Hey I'm gonna close this because I've gotten a hold of a virtual machine and started testing this app on Mint and worked on some of this, of course your welcome to improve the changes I've made to add better compatibility since this is my first time using Linux.

If you are still interested take a look at the latest commits to the future-update branch