Cameyo

Members Login
Username 
 
Password 
    Remember Me  
Post Info TOPIC: Shortcuts with different working directories
Scott

Date:
Shortcuts with different working directories
Permalink   
 


With shortcuts there is a target parameter which is a path to the directory including parameters and a start in directory parameter.  This is used to run a shared executable and have a working directory for each application instance.  I've tried setting the environment variable CAMEYO_STARTINGDIR which does result in the correct behavior.  Using the environment variable though has a couple of problems.  First you have to set it outside the virtualized package which means I need to wrap the Cameyo package with something else (batch file, launch exe, etc).  Second a number of my packages have multiple applications contained and the environment variable lets one work but the others are broken.

It seems like in the package editor launch menu would have a working directory parameter per launch item.  Is this something that exists (it seems like a basic feature of shortcuts) or is there a way to support multiple packages start directory?



__________________


Guru

Status: Offline
Posts: 912
Date:
Permalink   
 

Hello Scott,

Have you used Package Editor and looked in Startup: under the General tab?  There, you can navigate to your executable and add application-specific parameters.



__________________
Scott

Date:
Permalink   
 

I don't understand that answer, sorry.  I'm not having trouble with the parameters to the program but the working directory (where the app starts).  I looked at the packager and played around with the Startup/Specific Command functionality.  That allows you to autolaunch a single command with parameters and not have a launch menu.  I could still not figure out how in the launcher to change the working directory.  Basically start an exe located in one directory but have it's working directory in a different one.  This is a basic feature of Windows shortcuts which was why I was assuming there was a way to do this.  It seems a range of shortcuts would be broken without this behavior (this is what I was seeing with my captured applications).

 

That being said I've been hacking around for a while and have a solution I'll describe in case anyone else needs to do this and in case I forget what I did...

My directory layout looks like this:

\Program Files\App\Dosbox

\Program Files\App\DosApp1

\Program Files\App\DosApp2

 

To execute a program you run \Program Files\App\Dosbox\Dosbox.exe, but start the app from the working directory (\Program Files\App\DosApp1) and pass in a parameter to dosbox with the configuration file to run the program.  This is where the separate of exe location and working directory comes into play.  Dosbox just tries to load the app from the working directory (".\") so you need to be in the DosApp1 directory in order for it to find the configuration file.

 

The way I was able to work is as follows:

In the package editor create a launch menu item (I show how to create the cmd file later):

Name: DosApp1

Target:%system%\cmd.exe

Arguments: /C ""%ProgramFiles%""\App\LaunchDosApp1.cmd

 

NOTE: If you are having trouble launching the app change the /C in the arguments to /K and that will leave the dos window around for you to debug the script.

 

Create a command file in notepad with this contents:

CD %ProgramFiles%\App\DosApp1

..\DOSBOX\dosbox.exe -conf dosbox.conf -noconsole -c "exit"

 

Inside the package editor go to Files tab.  Navigate to the %Program Files%\App directory and add the command file there.

 

Save the package.  Now when you select the DosApp1 it will run a command window, navigate to the right directory, launch the app using a relative path so it uses the right working directory, and the exits everything cleanly on shutdown.

 

 

 

 

 

 

 

 



__________________


Guru

Status: Offline
Posts: 912
Date:
Permalink   
 

I'm glad you found a workaround.

The following might also work for you.

1. Create a shortcut to your executable, e.g. %ProgramFiles%\App\DOSBOX\dosbox.exe -conf dosbox.conf -noconsole -c "exit"

2. Add this shortcut to your package in the location of your working directory, e.g. %ProgramFiles%\App\DosApp1

3. Change startup to the shortcut you created, e.g. %ProgramFiles%\App\DosApp1\dosbox.lnk



__________________
Anonymous

Date:
Permalink   
 

Thanks that works too.  So for programs that already have shortcuts created as part of installation you can just copy the shortcut into the working directory and launch that shortcut.  This avoids having to create a command file to launch the program.



__________________
Page 1 of 1  sorted by
 
Quick Reply

Please log in to post quick replies.



Create your own FREE Forum
Report Abuse
Powered by ActiveBoard