Giter Club home page Giter Club logo

Comments (4)

eth-p avatar eth-p commented on August 27, 2024 1

I'm not convinced that we'd need another env var for this.

Adding on to what you said, I don't think environment variables are appropriate for this purpose. It comes across as antithetical to have a program use its environment to decide if it should ignore said environment.

Also: One would have to export the hypothetical environment variable in their shell profile as well, so it wouldn't even be "portable" in the sense that you could run it anywhere and expect the same behavior everywhere.

In my opinion, a portable version of bat would be better achieved as either a build feature or a shell script that sets BAT_CONFIG_PATH and BAT_SYSTEM_CONFIG_PREFIX before running bat.

from bat.

keith-hall avatar keith-hall commented on August 27, 2024

and a system-wide configuration file stored in C:\ProgramData on Windows, with a fixed path that cannot be changed by the user or disabled

you could just set the BAT_SYSTEM_CONFIG_PREFIX env var to a non-existing location to disable the system-wide config. I'm not convinced that we'd need another env var for this.
But I agree that hard-coding the path is not ideal.

2. If a user overrides the user-level config path, I think they would not expect bat to still use the system-wide path, but I might be wrong.

Well, the readme clearly states:

If the system wide configuration file is present, the content of the user configuration will simply be appended to it.

So there's no reason for that not to apply just because of specifying a different location for the user config file. I imagine there are use cases where you have machine-level config which you always want to apply and you want to override it differently in different scenarios with different user config files.

from bat.

MatejKafka avatar MatejKafka commented on August 27, 2024

you could just set the BAT_SYSTEM_CONFIG_PREFIX env var to a non-existing location to disable the system-wide config.

That variable is compile-time only, I cannot set it at runtime.

I imagine there are use cases where you have machine-level config which you always want to apply and you want to override it differently in different scenarios with different user config files.

Fair point.

from bat.

MatejKafka avatar MatejKafka commented on August 27, 2024

@eth-p

Generally, there are two types of portable apps:

  1. Apps that explicitly support portable mode by e.g. detecting a configuration file in the application directory. This easy to use, but hard to customize in case the user disagrees with the default portable data locations.
  2. Apps that are not explicitly portable, but provide ways to override all non-portable paths, either using env vars, CLI arguments, or a config file referenced using one of the other two methods. When these apps are used, the user or the packager typically create a launcher that internally invokes the actual binary and either sets environment variables or passes extra command-line arguments to change the default data paths.

Most systems for packaging portable apps, such as PortableApps.com, portapps, Scoop, and my own Pog have a way to easily generate launchers. Additionally, all of the projects prefer to use existing releases, since building a custom version from source adds complexity, and requires the maintainer to redistribute the binaries, which is against commonly-used proprietary licenses (not an issue with bat).

For these projects, option 2. is preferred, since the packages should have a fixed, consistent structure, which is often not achievable with option 1. For more details about the options for passing the configuration, you might be interested in Section 4 ("Making applications portable") of my thesis (https://matejkafka.com/share/Pog-thesis.pdf).

from bat.

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.