Giter VIP home page Giter VIP logo

Comments (6)

horror-proton avatar horror-proton commented on June 2, 2024 1

I guess falling back to system library makes sense.

Perhaps std::env::current_exe can be wrapped with something like realpath in case it was executed from a symbolic link 🤔
e.g.:

~/.local
├─bin
│ └─maa -> ../stow/maa_cli-0.0.0/bin/maa
└─stow
  └─maa_cli-0.0.0
    └─bin
      └─maa

resource should also be in .local/stow/maa_cli-0.1.2, not somewhere outside.

from maa-cli.

Cryolitia avatar Cryolitia commented on June 2, 2024

image
std::env::current_exe has platform-specific behavior, which make it worse to just find lib and resource in current_exe's parent directory, when users make a symbol link from maa.exe to their Desktop or Startup Menu or so.

from maa-cli.

wangl-cc avatar wangl-cc commented on June 2, 2024

std::env::current_exe has platform-specific behavior, which make it worse to just find lib and resource in current_exe's parent directory, when users make a symbol link from maa.exe to their Desktop or Startup Menu or so.

The main reason we are currently searching for the lib and resource directories in the parent directory of current_exe is to accommodate users who may have installed CLI in various locations, such as ~/.local/bin. While this approach isn't ideal, it was chosen for its flexibility and as a fallback option.

However, when it comes to package managers, locating the lib and resource directories becomes much simpler. One potential solution is to introduce a compile time environment variable of lib and resource path for the package manager. This could potentially present challenges for prebuilt packages, such as Homebrew on Linux, where users have the flexibility to install packages in non-default locations, including within their home directories.

It's worth noting that the necessity for relocatability may vary among different package managers. If other package managers do not require it, this solution could be viable, since installing in non-default locations is discouraged by Homebrew.

Search MaaCore.so in LD_LIBRARY_PATH will be greater.

I believe it's a good idea and aligns with the default behaviour of dlopen. I'll delve into this further to explore its feasibility.

from maa-cli.

wangl-cc avatar wangl-cc commented on June 2, 2024

I just add support for search LD_LIBRARY_PATH.

I'm interested in hearing your opinions about the environment variables. @Cryolitia, what are your thoughts on this? And @horror-proton, I'd also like to hear your perspective.

from maa-cli.

wangl-cc avatar wangl-cc commented on June 2, 2024

With the resolution of the current_exe issue and the support for searching system libraries, I believe there is no need for additional environment variables. Consequently, I close this issue as completed. Feel free to reopen it if you think it was not resolved.

from maa-cli.

Cryolitia avatar Cryolitia commented on June 2, 2024

That's great!

with commit 32c0857 , there's also no need for resource_dir.

Thanks for your hard work.

from maa-cli.

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.