What's wrong with NSIS shortcut? - json

Should warning, that english is not my native, sorry for grammar misstakes.
I have a problem with shortcut that i create with NSIS. The shortcut's link leads to exe file, that use a json config, config is in the same directory with exe, and when i use the shortcut it returns me an error, that it can't finde the config, cause it's searching in the shortcut's directory. But when i make the shortcut by myself it works correct - searching config in the exe's directory. I need to create the shortcut, that will uses a config which lies in instdir. How to make it correctly?
That's how i create the shortcut:
CreateShortCut "$DESKTOP\%link_name%.lnk" \
"$INSTDIR\%SomeDir%\Application.exe" \
"" \
"C:\Users\Daniil.Bogdanov\Pic\logo.ico" 0
The config and exe lie in %SomeDir%

This isn't the most intuitive thing but CreateShortCut sets the working directory for your shortcut based on the current $OUTDIR value.
https://nsis.sourceforge.io/Docs/Chapter4.html#createshortcut
$OUTDIR is stored as the shortcut's working directory property. You can change it by using SetOutPath before creating the shortcut
So I'm guessing that your output path isn't the same as the location of your executable. This could be remedied by using SetOutputPath right before creating your shortcut.
SetOutPath "$INSTDIR\%SomeDir%\"
CreateShortCut "$DESKTOP\%link_name%.lnk" \
"$INSTDIR\%SomeDir%\Application.exe" \
"" \
"C:\Users\Daniil.Bogdanov\Pic\logo.ico" 0

Related

The terminal shell path "..\..\..\vsCode\git\bin\bash.exe" does not exist in VS Code Windows

I am trying to set a portable development Environment:
VS Code - Portable mode
git-bash - portable
Node.js - portable
VS Code throws Error: The terminal shell path "......\vsCode\git\bin\bash.exe" does not exist
I have C:......\Documents\Storage\vsCode\data\user-data\User\settings.json
and C:......\Documents\Storage\vsCode\git\bin\bash.exe
settings.json:
{
// Git Bash
"terminal.integrated.shell.windows": "..\\..\\..\\vsCode\\git\\bin \\bash.exe"
}
It works in CMD:
C:\.........>cd C:\...........\Documents\Storage\vsCode\data\user-data\User
C:\.......\Documents\Storage\vsCode\data\user-data\User>cd ..\..\..\git\bin\
C:\.......\Documents\Storage\vsCode\git\bin>
Can you guide me how to deal with relative path in VS Code without setting global variables in the operating system. I will need to do the same thing with Node.
Sorry for the messy post but I am fairly new to posting here.
You can follow below link :
https://code.visualstudio.com/docs/editor/integrated-terminal
You need to edit the terminal integrated path in settings.json file to which ever thing you want it to compile it with
See the URL in the screenshot to find the location for settings.json file at my end:
I searched for "shell path" in the VS Code settings and noticed that the path was wrong
(Program Files instead of Program Files (x86))
I had to change it to
"terminal.integrated.shell.windows": "C:\\Program Files (x86)\\Git\\bin\\bash.exe",
#Rhatalin thank you for the suggestion. I had the same issue on Windows 10. After updating below setting in settings.json (File -> Preferences -> Settings search for shell and choose Terminal-Integrated-Automation Shell: Windows -> Edit in settings.json) the issue was gone.
"terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe"
After a Windows update, I got the same error. I had to add escape \ characters to each backslash in the path to get it to work again. (check your path to make sure each single \ is double \)
This works: "C:\Program Files\Git\bin\bash.exe"
This does not work: "C:\Program Files\Git\bin\bash.exe"

How to launch Sublime and define the file syntax in one go?

Sound as lazy as it is I was wondering if it's possible to open a file with sublime using (command line) and in the same command define the expected syntax.
Lets say on a mac we have the subl command installed, so running $ subl .bash_something will open the .bash_something then we have to chose the "shel script(bash)" syntax from the list. what would be really nice (for laze me) is to include the syntax to the command as an argument. i.e.
$ subl -x bash .bash_something
or something like that. this obviously doesn't work but I was wondering if there is similar solution or if its possible to include one
Unfortunately, there is no way that I can find to dynamically set the syntax from the command line. subl has the --command option, which allows you to run a Sublime command while loading the file, directory, or project indicated. However, the command to change the syntax of a view - set_file_type - takes an argument of the form ("syntax": "Packages/PackageName/SyntaxName.sublime-syntax") (or SyntaxName.tmLanguage). As far as I've been able to tell, you simply can't pass arguments to commands run via the command line. I've opened an issue to request an enhancement.
Now, this doesn't mean that all is lost. If you have just a few filetypes that are unknown to Sublime, open them, then select View -> Syntax -> Open all with current extension as... and select the syntax you want. If for some reason this isn't sufficient, or would like finer-grained control over exactly which filenames (not just which extensions) get opened as what, check out the ApplySyntax plugin. It allows you to use regexes to open exactly which file patterns you define as what syntax.
Commands can take arguments in Sublime 3 now. I was able to achieve this functionality with a bash function.
You can pass arguments to the --command option with inline JSON and escaped quotes. This command will change the syntax to Bash for the current active file in Sublime:
subl --command "set_setting {\"setting\": \"syntax\", \"value\": \"Packages/ShellScript/Shell-Unix-Generic.sublime-syntax\"}"
I created a simple bash function and sourced it in my .bash_profile to wrap these two commands together to activate/open a file then change the synax:
function subl_bash() {
subl "$1" && subl --command "set_setting {\"setting\": \"syntax\", \"value\": \"Packages/ShellScript/Shell-Unix-Generic.sublime-syntax\"}"
}

How to browse zip files in vifm

I want to be able to browse zip files and their subfolders from vifm.
By default(after a clean installation) the vifm does not support such functionality.
If you didn't alter sample vifmrc, then it already contains necessary configuration to open zip files using FUSE. It looks like this:
filetype *.zip,*.jar,*.war,*.ear,*.oxt
\ {Mount with fuse-zip}
\ FUSE_MOUNT|fuse-zip %SOURCE_FILE %DESTINATION_DIR,
As you can see it invokes fuse-zip to mount archive as a directory. FUSE is probably present and working (assuming that you use GNU/Linux, but there is also OS X analogue; Windows seems to had one too, but it's probably incompatible with FUSE mounters out there), so all you need is to install fuse-zip.
The same way you can browse anything if there is a FUSE module for it (tar, rar, iso, 7z).

How do I extend the $PATH that Sublime Text 2 uses?

I just installed Sublime-jshint (and the requisite node.js + jshint) but get this error when I try to invoke JSHint from within ST2:
[Errno 2] No such file or directory
[cmd: [u'jshint', u'PATH-TO-THE-JS-FILE-I-AM-LINTING', u'--reporter', u'/home/cmg/.config/sublime-text-2/Packages/JSHint/reporter.js']]
[dir: DIR-MY-JS-FILE-IS-IN]
[path: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/cmg/bin]
[Finished]
The final item in the given path is in the home dir of my user (cmg), so it's been customized somehow... but I don't recall how, so I don't know how to add the dir I need (~/node_modules/.bin).
I've added it to $PATH in my shell (via both .bashrc and .bash_profile) but ST2 doesn't pick it up.
(I'm on Ubuntu 14.04. All the usable stuff I've found via Google on this subject has been either OS X specific or related to ST's build system).
Basically, the exec command, which the jshint package uses internally, allows you to set/extend the PATH of the spawned subprocess. (docs)
The package actually uses this path argument on OSX, but has it hardcoded (I am partly guilty of that as I rewrote the command because it was just horrible before). It should allow for a setting to specify the path to your jshint executable, so I suggest you create an issue for that.
I don't know why ST dosn't pick up your PATH from somewhere else since I have very little experience with that.
Open /etc/profile in Sublime (using sudo) and add the following line at the very bottom:
export PATH=/home/cmg/node_modules/.bin:$PATH
and save the file. Restart completely, and your PATH should be updated.

Open an .html file with default browser using Bash on Mac

So, this is what I need :
Let's say I have an index.html file.
How do I tell the terminal to open it using the default browser?
(Using AppleScript, BASH,...?)
from the directory containing index.html, try...
open ./index.html
the open command opens a file (or directory, or URL). open is included with MacOSx. specifics and options can be found using
man open
note: default application is determined via LaunchServices.
You can use the open command with the -a flag to open a file or location in Chrome (or any target application):
open -a "Google Chrome" index.html
This also works with URLs, i.e. open -a "Google Chrome" http://www.apple.com.
---> I found this answer # stack exchange, thanks to user "robmathers"
Actually, this is not quite as straightforward as it looks. As suggested by the other answers, OS X provides the open utility to launch applications matching a file type from the shell. However, in the case of a HTML file, that is the application registered with Launch Services for the file type public.html, which can, but need not be, your default browser (I think it is on a pristine install) – or whatever editor registers as able to edit HTML (not an uncommon occurrence on a dev system). And while the default browser is registered for the URL protocol http no matter what, there is no way to access that protocol handler to open a file with open.
To compound the issue, although the handlers are stored in the com.apple.LaunchServices.plist preferences accessible via the defaults command, the structure of the information (a dictionary with two same level entries, one denoting the protocol, one the handler) makes it non-trivial to parse with defaults.
The good news is somebody already solved that problem: HAMsoft Engineering offers the DefaultApplication shell utility. Download it and save it somewhere where it is accessible to the shell (typically /usr/local/bin, although that is not in the default path for shells on some OS X versions – check the contents of /etc/paths to be sure). That available, the following command will open a HTML file in the default browser, whatever editor / viewer might be registered otherwise:
open -a "$(/usr/local/bin/DefaultApplication -url 'http:')" "/path/to/your/document.html"
To open the filename.html in the default browser use :
open filename.html
open is a very good command as well as a feature of Mac OS that makes me fall in love with it more deeper.
It automatically chooses the appropriate default app to open the file.
And in case you want to open a file in your desired app rather then default :
open -a /Applications/Google\ Chrome.app filename.html
The backslash \ after Google is used to escape the space character.
Alternatively you can write :
open -a "/Applications/Google Chrome.app" filename.html
Hope this helps you ( I know I am very late ) and others !!!.
You can also get the default browser with Perl: open http://example.com -a "$(VERSIONER_PERL_PREFER_32_BIT=true perl -MMac::InternetConfig -le 'print +(GetICHelper "http")[1]')".
i managed to open the html file with chrome by placing the file after the browser command. so,
google-chrome-stable ./index.html
although im not sure what the call would be to the default browser, if you knew it you could put it as an alias in your .bashrc and from then on, use whatever you called your alias, plus the file.
goo ./index.html
just my experience, first response
In terminal you can run open index.html
this works on linux, should also work on mac
#!/bin/sh
# open a html file in default browser, not text editor,
# when text editor is set as default app for html files
url=file:///path/to/file.html
protocol=http
app=$(xdg-mime query default x-scheme-handler/$protocol)
# example: chromium-browser.desktop
[ -z "$app" ] && {
echo "error: xdg-mime could not find default app for protocol $protocol"
exit 1
}
app=$(basename $app .desktop)
gtk-launch $app "$url"
ideally i could just say
xdg-open http+file:///path/to/file.html
but this is not working