Issue #6 resolved
mohan ramanujam
created an issue

can I set env_file to use .bash_profile. This will allow a consistent basis for setting all environment variables including path do any required validation, etc. I notice you allow calling of a shell and I have not tested if .bash_profile.sh will work also. Please provide clarification on this in your documentation.

Can you also clarify in your documentation how to set system wide environment vs project wide.

Comments (7)

  1. mohan ramanujam reporter

    My environment is windows where I may stated Sublime Text from windows or from cygwin or msys shell environments. You specify windows, linux, darwin. Which env_file settings should be used given the variability of sublime_text use on windows.

  2. Daniele Niero repo owner

    Hey Mohan,

    Have you actually tried to use EnvironmentSettings and set up env_file in your settings to point to .bash_profile?

    I'm asking because the documentation is pretty clear about it and in fact I don't think I need to clarify anything. Furthermore .bash_profile is executed on unix environments (linux, mac) just before the system become ready at start-up. If you set some environment variables in it, those will be global and always available throughout your system. When you start a software, like Sublime, those variables are available in the software.

    So the documentation is clear about this point:

    The variables can be set in the "settings" part of a .sublime-project file.
    Here two entries can be created:

    • env_file
      To point to an external shell file. If this file sets variables, those variables will be set also in Sublime.
      Paths can be relative to the project file itself (ex: "../../env.sh")
    • env
      is a dictionary. Each key:value pair will be set as environment variable.

    .bash_file is an external file. Is it because I said external shell file that put you off?

    Can you also clarify in your documentation how to set system wide environment vs project wide.

    It is already, here.
    I will rewrite down here for clarification:

    Beside setting variables per project, it's also possible to set variables for all the projects and sections of Sublime.
    To do that, just open your user EnvironmentSettings.sublime-settings and set the variables in there.

    Although, to be picky, system wide environments, should be set in your system (which is again what you do in .bash_profile if on linux or mac, and finding those crazy menus somewhere in your system preferences if you are on Windows). Again, when variables are set into the system, as user or global variables, they are propagated to any software.

    My environment is windows where I may stated Sublime Text from windows or from cygwin or msys shell environments. You specify windows, linux, darwin. Which env_file settings should be used given the variability of sublime_text use on windows.

    There is not variability of sublime_text use on windows. The fact that you are using cygwin or mysys doesn't change the fact that you either running sublime on windows or whatever cygwin creates (I don't know if it is an emulator or a virtual machine or something else), but sublime is compiled to run on 3 systems. Find out which Sublime you are running and you have your answer, but I'm afraid you can't expect me to know all the possible setups a user may have on his/her machine, those are things you should take care of.

    Let me stress again the fact that there are only 3 flavour of Sublime, Windows, Mac or Linux, find out which one you have and where it is running and you have your answer. But don't ask me how your machine works :)

  3. mohan ramanujam reporter
    • Project vs Global settings clear now. Sorry I was not aware of the project environment where you could define project specific settings
    • windows bat file threw me off. In case where ST is launched from windows/cmd environment I call a bat file which executes .bash_profile (some tools are only available under mingw or cygwin environment so I figured I needed to cover the basis . Am I wrong in doing this.
    • I noticed that some/many packages seem to make explicit path references in their environment specifications. I was wondering why they were not availing themselves of environment and windows/shell path settings to find files. Therefore, I was going to use your package to make those same environment variables available to all packages.
    • Is there a way to print all environment variables visible to ST and/or made available by your package. I see print_output but have not tried it.
  4. Daniele Niero repo owner

    windows bat file threw me off. In case where ST is launched from windows/cmd environment I call a bat file which executes .bash_profile (some tools are only available under mingw or cygwin environment so I figured I needed to cover the basis . Am I wrong in doing this.

    Well it sounds like, I don't think you can possibly mix cmd and cygwin. But again, I cannot possibly really know how you set up your environment and tools.

    I noticed that some/many packages seem to make explicit path references in their environment specifications. I was wondering why they were not availing themselves of environment and windows/shell path settings to find files. Therefore, I was going to use your package to make those same environment variables available to all packages.

    It's their development choice. If they use hard-coded paths or their own way to make it dynamic, not based on environment variables, then my module cannot help you.

    Is there a way to print all environment variables visible to ST and/or made available by your package. I see print_output but have not tried it.

    There are many ways to do that, I would use python in ST console. But this is not the scope of this plugin so no, you can't do it with EnvironmentSettings, print_output is just a way to debug what EnvironmentSettings is doing

  5. Log in to comment