[CMake] How to change the "Start in" directory for Windows Start menu shortcuts

David Cole david.cole at kitware.com
Wed Oct 5 15:35:48 EDT 2011


On Tue, Oct 4, 2011 at 6:37 PM, Ben Medina <ben.medina at gmail.com> wrote:
> Hello all,
>
> We're using NSIS via CPack for our Windows installer. One thing we'd
> like to change is the "Start in" directory for Windows Start menu
> shortcuts. Currently, it appears to default to the installation
> directory, but that's not very useful: users aren't going to be saving
> files underneath C:\Program Files\MyApp. Is it possible to change the
> start in directory?
>
> Thanks,
> Ben
> --
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>


You could customize the NSIS template to write your own NSIS
CreateShortCut calls. There's more info on customizing the NSIS
template in the mailing list archive. If you have trouble finding it,
let me know, and I'll dig up a pointer.

The docs for CreateShortCut are here:

  http://nsis.sourceforge.net/Docs/Chapter4.html#4.9.3.4

The docs say "$OUTDIR is used for the working directory. You can
change it by using SetOutPath before creating the Shortcut." I'm
assuming that's what the working directory will be for the shortcut.
(If I'm reading the docs correctly...)

Of course, if I were going to do such a thing, I'd also save/restore
the value of $OUTDIR across the CreateShortCut operations because I
have no idea what else in NSIS depends on that value in a hidden way
like this...


Or..... you could simply write your app to ignore the "start in"
directory, and present things like file open and save dialogs pointing
to the user's home directory to start with, like most document based
apps do.


HTH,
David


More information about the CMake mailing list