I have the following NSIS code
Function CreateDesktopSC
;Creates Desktop Shortcut
SetShellVarContext current
SetOutPath "$DOCUMENTS\Foo\"
SetShellVarContext all
detailprint "Icon path: $INSTDIR\Bar\icon.ico"
CreateShortCut "$DESKTOP\${productName}.lnk" "$INSTDIR\Bar\binary.exe" "" "$INSTDIR\Bar\icon.ico" 0
FunctionEnd
The install log shows the following (from the detailprint command)
Icon path: C:\Program Files (x86)\Bar\icon.ico
The shortcut is created, but with the icon from the executable.
If I open the lnk file or right click the shortcut and click "Change Icon ...", I get the error "Windows can't find the file %ProgramFiles%\Bar\icon.ico."
If I browse to %ProgramFiles%, it takes me to c:\Program Files, not the x86 version as shown in the detailsprint command. The icon file exists, but in the x86 folder.
It appears that either NSIS or windows is replacing "C:\Program Files (x86)\" with "%ProgramFiles%", which doesn't point to the x86 version.
The actual path to the executable is correct, it's only the icon link which is incorrect.
Any ideas?
The workaround from the thread is to add an second \ to your icon code. I didn't really got why this helps on 64bit systems but it does...
so replace:
CreateShortCut "$SMPROGRAMS\$StartMenuGroup\${PRODUCT_NAME}.lnk" "yourapp.exe" "$INSTDIR\${APPLICATION_ICON}"
with
CreateShortCut "$SMPROGRAMS\$StartMenuGroup\${PRODUCT_NAME}.lnk" "yourapp.exe" "$INSTDIR\\${APPLICATION_ICON}"
After adding the second \ before APPLICATION_ICON the icon will be displayed again
Confusing but it works
NSIS just uses the documented IShellLink interface. There is a thread about it on the NSIS forum (with a workaround you can try). I believe it is a bug in WOW64... (The registry redirector is docmented to change %ProgramFiles% to %ProgramFiles(x86)% behind your back, I suspect IShellLink is missing this hack)
Disable redirection
Load Icon from path
All is done with System plugin. Why to complicate ...
http://nsis.sourceforge.net/Docs/Chapter4.html#4.9.3.4 seems to be wrong, for me what worked was:
CreateShortCut "$SMPROGRAMS\${PRODUCT_PUBLISHER}\${SHORTCUT_NAME}.lnk" "$INSTDIR\${PRODUCT_EXE}" "$INSTDIR\${PRODUCT_EXE}" "$INSTDIR\MyIcon.ico"
Related
I tried the following to open a file dialog that should display the users home directory:
QString fileName = QFileDialog::getOpenFileName(this,
tr("Select database"), QDir::homePath(),
tr("Database Files (*.db *.sqlite)"));
The problem ist that QFileDialog always starts with the directory from where the application was started. Any ideas what I'm doing wrong ?
BTW: I'm using Qt 5 on Mac OS X.
In Mac OSX, QDir::homePath() returns the content of the HOME environment variable. So if this variable is empty, it returns an empty string.
Ensure the 'Clear system environment' option (under Build Environment from the project settings in Qt Creator) is not checked. When you check this box, Qt will basically overwrite the value of every environment variable for your program, so it would appear to be empty.
Use QDir::homePath() as suggested earlier or consider usage of Qt5's QStandardPaths class.
I am following a tutorial for ruby on rails and in the video the guy opens the directory we are currently inside in terminal as a textmate project. I am not sure how to do this.
When you are in a directory in terminal, to open all files in TextMate, use
mate .
If you want to open a single file, use
mate <the file name>
You can use the mate terminal command, see how to use it here:
http://manual.macromates.com/en/using_textmate_from_terminal.html
HTH
If you are using the textmate 2, it comes with this command line utility. What you need to do is turn it on.
Go to "Preferences", and then "Terminal" to turn on.
See http://blog.macromates.com/2011/mate-and-rmate/
I want to add libboost_filesystem.dylib to my Xcode target as a library to link to, but Boost is installed in /opt/local/lib.
/opt is hidden and not accessible from the open panel, so I cannot select the dylib:
How can I add the library to my target?
Cmd-Shift-G in any open dialog under OS X triggers "go to folder" (in which you can enter any path). Alternatively you can open /opt/local/lib in the Terminal (which opens the folder in a Finder window), then drag the library into your project.
You can first make the finder show all files.
Maybe "defaults write com.apple.finder AppleShowAllFiles -bool true" will be worked.
I have created an application that compiles and runs like a charm on OS-X. I would now like to start getting it to work on Windows. To start, I copied the project to a windows machine and just tried to compile, but got this error:
:: warning: Qmake does not support build directories below the source directory.
Any ideas?
Set the shadow build directory to some folder on the same level of your project directory:
folder/
project/
project-shadow-build-release/
project-shadow-build-debug/
You can do this in the "Projects" view, via the toolbar on the left. To me, this warning was just an annoyance, a project never failed to build because of it.
Don't copy your project.pro.user file when you are copying a project from one machine to another, or from one directory to another. When you open the project, Qt Creator will offer to create a new build directory in the proper place.
Andref gave the correct answer to resolve this warning, but you may want to understand why this requirement exists.
In fact, the build directory must be at the same folder level as the project (i.e. it can't be above or below). The reason why is that the linker is called from the build directory. Hence, any relative paths to library files will be different than what you entered in your project file.
It kinda sucks. I like to put all intermediate files in their own folder. But you simply can't with qmake.
.pro.user are generated files by Qt Creator. They are unrelated to qmake and should not be touched (and not put into a VCS for that matter)
Just remove the files with the pro.user extension , worked for me
I also got this, trying to compile a project created on linux.
Another way to solve it is to change the paths in the .pro.user file (in the directory of your project)
Right Click on a project: Set As Active Project
Click on the Projects button (The one with the spanner image)
Edit build configuration : Debug / Profile / Release / and change the default directories, OR just uncheck the Shadow build check box.
The Build directory path should now change to black, from red
how can I change Qt install path after I building it ?
Example : qmake.exe search binaries to original install path, how can I change/redefine it ?
Thanks.
Edit : I finally found this patch to apply to Qt :
http://ftp-developpez.com/qt/binaires/win32/patcher/QtPatcher.7z
http://ftp-developpez.com/qt/binaires/win32/patcher/QtPatche_src.7z
I was looking into this and found a way that works (in qt 4.7.2) by customizing qt with a qt.conf file.
In my case, I added a qt4-4.7.2/bin/qt.conf (I think it must be in the same place as the qmake executable)
With the following contents:
[Paths]
Prefix = c:/my_path/to/qt4-4.7.2
and the qmake -query started returning the proper paths!
See: http://qt-project.org/doc/qt-5.0/qtdoc/qt-conf.html for more details
You can change path to binaries and many other hardcoded paths in qmake using qmake -set command.
See Configuring qmake's Environment for details.
I can answer it for windows, not so sure about others. Remove the path variables if any present in the environmental variable PATH.
In Qt-Creator goto,
Tools->Options->Qt4->Qt Versions
In the right hand side area, you will find Auto- Detected and Manual. Under Manual add a new entry by clicking the + symbol in the far right. Specify the QMake location by clicking Browse . Change the Default Qt Version to your newly specified Version. Of course, you have to re -build the application. Hope that it helps.
On Unix/Linux:
You can also use LD_LIBRARY_PATH+PATH for workarounds. But still, some defaults are hardcoded in the code, yes. A rebuild is a must.
On unix you can make a symbolic link, otherwise you probably need to rebuild it
This worked for me with Qt 5.15.2:
cd ~/Qt/Tools/QtCreator/share/qtcreator/QtProject
grep -inr '<olduser>' | cut -d: -f1 | xargs sed -i 's/<olduser>/<newuser>/g'
Replace <olduser> and <newuser> obviously.