New PortableApps.com Platform 12.0.5. Better, stronger, faster. Download or Buy on Drive
Instant access to over 300 free and legal portable apps including the new Firefox Developer (Nov 10, 2014)
PortableApps.com needs your help: Please donate today

Questions regarding Creation of a *.paf.exe File

tapsklaps
Developer
- February 22, 2011 - 3:01pm
Share on Facebook

I want to make portable the app streamWriter (http://streamwriter.org/en/). The goal of this app is to record music broadcasted by internet-radiostations. I have downloaded the file streamwriter.zip and extract it in the directory C:\streamwriter\, which contains the files streamwriter.exe and bass.dll. Afterwards I have created the file and directory layout according to the PortableApps.com Format™ Specification.

Afterwards I arrange some questions regarding the creation of a *.paf.exe file.

  1. During regshotting I must arrange some preferences regarding the app. Among other things I chose the portable mode of installation. These preferences are stored in a file called "streamwriter_settings.ini". Furthermore a file called "streamwriter_data.dat" was created. Both files are stored in the directory C:\streamwriter\. Additionally I must determine a folder, in which the songs can be saved. Therefore I create a folder "Downloads" within the directory C:\streamwriter\. I copy now all 4 files (streamwriter.exe, bass.dll, streamwriter_settings.ini and streamwriter_data.dat) and the folder Downloads of the directory C:\streamwriter\ in the directory streamWriterPortable\App\streamWriter\.
    Is this correct?
  2. As the app need the file streamwriter_settings.ini, I write the following line of code in the section [Launch] of the file streamWriterPortable.ini:

    • WorkingDirectory=%PAL:AppDir%\streamWriter

    Is this correct?

  3. The app creates a folder called "streamWriter" in the TEMP directory of my local machine. This directory must removed after the application has run. Therefore I notice the following lines of code in the file streamWriterPortable.ini:

    • [DirectoriesCleanupForce]
      1=%TEMP%\streamWriter

    Is this correct?

  4. As I described under Nr. 1, I copy the folder Downloads from the directory C:\streamwriter\ in the directory streamWriterPortable\App\streamWriter\. In the file streamwriter_settings.ini exist the following line of code:

    • Dir=C:\streamwriter\Downloads\

    Instead of saving the songs in this folder at the local machine, I want to save the songs in the folder Downloads within the directory streamWriterPortable\App\streamWriter\. Therefore I alter the file streamwriter_settings.ini as follows:

    • Dir=%PAL:AppDir%\streamWriter\Downloads\

    Is this correct?

  5. I use the PortableApps.com Application Template. Which meaning has the file AppNamePortable.ini in the directory streamWriterPortable\Other\Source?

In the meantime I figure out, that my method of resolution regarding the Nr. 4 above not works. I have installed the file streamWriterPortable_1.4.paf.exe inside the PortableApps.com Menu as well as outside the PortableApps.com Menu. In both cases I was prompted to choose a folder for saving the songs. But how can I solve this problem, which I described under Nr. 4?


( categories: )

Answers:

  1. These data files should go in Data, not in App.
  2. WorkingDirectory is unlikely to do it; if the app is well designed, it will not do it. Instead you probably need to move those files with [FilesMove] (there may be an environment variable or command line argument - it's worth checking).
  3. TEMP is kept clean automatically with PAL, unless you set [Launch]:CleanTEMP=false. So don't have this. (Incidentally, you should probably never use DirectoriesCleanupForce - instead, use a [DirectoriesMove] line with the key - and it will not be saved; that way it will still backup a local copy and not destroy it.)
  4. It's extremely uncommon for things like this to include environment variable parsing; you will need a [FileWriteN] section in your launcher.ini to do it.
  5. Read Other\Source\readme.txt

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

streamWriterPortable_1.4.paf.exe works

  1. I figure out, that all the 4 files (streamwriter.exe, bass.dll, streamwriter_settings.ini and streamwriter_data.dat) should reside in the App directory (exactly in the directory streamWriterPortable\App\streamWriter\). If I put some of this files in the Data directory (for example streamwriter_settings.ini and streamwriter_data.dat), then I must again arrange the preferences for the app. Only the folder Downloads I can put in the Data directory.
  2. I delete the line of code WorkingDirectory=%PAL:AppDir%\streamWriter. Afterwards I start the file streamWriterPortable.exe and it run successful.
  3. No I don't set [Launch]:CleanTEMP=false. Also I can't reproduce, how I can use a [DirectoriesMove] line with the key -. My goal was to delete the folder streamWriter, which leave in the TEMP directory of my local machine after the app was closed. But I try to delete the following lines of code:

    • [DirectoriesCleanupForce]
      1=%TEMP%\streamWriter

    And again it works.

  4. Sorry but I can't find a solution with a [FileWriteN] section in my launcher.ini to do it. I try divers alternatives without any success.

Under consideration of the both alterations regarding Nr. 2 and 3 I think it's the best, that I now post the file streamWriterPortable_1.4.paf.exe in the Beta Forum. As I mentioned in my original post, the file streamWriterPortable_1.4.paf.exe runs successful. At the first run of the app the user must only determine the folder,where the songs can be saved. Accordingly you can better see, what potentially is to do.

regarding 1

All the applications data should be saved/moved to /Data once the app closes so app and data are seperated and it can be backed up by the menu.

"What about Love?" - "Overrated. Biochemically no different than eating large quantities of chocolate." - Al Pacino in The Devils Advocate

clarification

For a better understanding I must clarify, what exactly application data display. Main task of the app is to record music broadcasted by internet-radiostations. Therefore exist a stream-browser on the right of the main window of the app ( look at the first screenshot at http://streamwriter.org/de/inhalt/screenshots/). After I chose one radio transmitter in this browser over rightclick with the mouse, this radio transmitter will take over left-hand of the main window of the app. If I now start to record this radio transmitter, I monitor that anything was stored in the file "streamwriter_data.dat". Accordingly I assume, that this file are the application data or? Therefore I must save the file "streamwriter_data.dat" in the directory StreamWriterPortable\Data. Is this now correct?

But how can I solve the problem, which I described under Nr. 4 of my original post?

Otherwise the file streamWriterPortable_1.4.paf.exe seems to run correctly. All Icons, the Splash Screen and the help.html file work nice. And no traces stay on the local machine.

EDIT: But if I consider the original app, all files inclusive the file streamwriter_data.dat are stored in one folder.

yes

Therefore I must save the file "streamwriter_data.dat" in the directory StreamWriterPortable\Data

Just use FilesMove (below):

[FilesMove]
streamwriter_data.dat=%PAL:AppDir%\streamWriter

that should do it Laughing out loud

regarding 3 and 4

3. PAL has this feature where it creates a folder in TEMP (called AppNamePortableTemp) and whenever the application writes to TEMP it goes into that folder and is deleted. Thus you needn't worry about whats created in TEMP.

4. Your code will look something like this:

[FileWrite1]
Type=INI
File=%PAL:AppDir%\steamWriter\streamwriter_settings.ini
Section=XXX #see note below
Key=Dir
Value=%PAL:DataDir%\Downloads

Please note that you will need to substitue XXX with the [section] in streamwriter_settings.ini. I would have done it, but you did not mention what it was.

Also, be sure that steamWriter creates the Downloads folder if it does not exist. If steamWriter doesn't, you will need to put an empty 'Downloads' folder in App\DefaultData so you don't run into problems

[FileWrite1]

Exactly this [FileWrite1] I use without any success (XXX=Settings). And curiously I can't find the folder Downloads after I compile the package with the PortableApps.comLauncher and PortableApps.comInstaller. Now I find in the Data directory a new subfolder called settings. In this subfolder settings I find a new file named "streamWriterPortableSettings.ini" with the following content:

  • [streamWriterPortableSettings]
    LastDrive=D:

EDIT: I have now read your advice to put an empty folder Downloads in App\DefaultData and I try it now again. But I must put this folder before I use the PortableApps.comLauncher and PortableApps.comInstaller or?

[FileWrite1] not the solution

After I put an empty folder Downloads in App\DefaultData, I find now a folder called Downloads in the directory streamWriterPortable\Data. However I can't solve the problem regarding Nr. 4 with your advice to use [FileWrite1].

If I want to use your advice regarding [FilesMove], must I alter the appropriate file streamWriterPortable.ini before I use the PortableApps.comLauncher and PortableApps.comInstaller? And can it be, that at first I must use the code [FilesMove] together with the code [FileWrite1]. And only in this case the code [FileWrite1] works or?

I also use the PortableApps.comAppCompactor. Is it possible, that the utilization of the PortableApps.comAppCompactor create a problem?

preliminary result

How recommended I have done some alterations.

The file streamWriterPortable.ini appears now as follows:

[Launch]
ProgramExecutable=streamWriter\streamwriter.exe
SinglePortableAppInstance=true
WaitForOtherInstances=false
[FileWrite1]
Type=INI
File=%PAL:AppDir%\steamWriter\streamwriter_settings.ini
Section=Settings 
Key=Dir
Value=%PAL:DataDir%\Downloads
[FilesMove]
streamwriter_data.dat=%PAL:AppDir%\streamWriter

The file appinfo.ini appears now as follows:

[Format]
Type=PortableApps.comFormat
Version=2.0

[Details]
Name=streamWriter Portable
AppID=streamWriterPortable
Publisher=Alexander Nottelmann & PortableApps.com
Homepage=PortableApps.com/AudacityPortable
Category=Music and Video
Description=streamWriter Portable records music broadcasted by internet-radiostation packaged as a portable app, so you can record on the go.
Language=Multilingual

[License]
Shareable=true
OpenSource=true
Freeware=true
CommercialUse=true

[Version]
PackageVersion=1.4.0.1
DisplayVersion=1.4 

[Control]
Icons=1
Start=streamWriterPortable.exe

And the file streamwriter_settings.ini appears now as follows:

[Settings]
MainMaximized=0
MainWidth=780
MainHeight=500
MainLeft=10
MainTop=50
ProxyEnabled=0
ProxyHost=
ProxyPort=8080
WasSetup=1
AutoUpdate=0
LastUpdateChecked=0
InstallUpdateOnStart=0
Language=de
FirstStartShown=1
LastUsedVersion=1.4.0.1
SuppressUpdatedInfo=0
FilePattern=%s\%a - %t
Dir=%PAL:AppDir%\streamWriter\Downloads\
DeleteStreams=1
AddSavedToIgnore=1
SkipShort=1
SearchSilence=1
SilenceLevel=5
SilenceLength=150
SaveToMemory=0
TrayClose=0
TrayOnMinimize=0
SidebarWidth=230
SubmitStreams=1
ShortSize=1500
SongBuffer=0
MaxRetries=100
RetryDelay=5
DefaultFilter=0

Only for the problem regarding Nr. 4 of my original post I can't find a solution. But the user has at the first run of the app the possibility to determine a folder, in which the songs are saved. Thereby it's recommendable to choose the folder streamWriterPortable\Data\Downloads. Accordingly no traces stay on the local machine in this case.

Well

First, the streamwriter_settings.ini is wrong. It is read by the program and shouoldnt contain "%PAL:AppDir%". And imho, streamwriter_settings.ini should be inside /Data as it is config data. You can add

streamwriter_data.ini=%PAL:AppDir%\streamWriter

to [MoveFiles] to move it.

"What about Love?" - "Overrated. Biochemically no different than eating large quantities of chocolate." - Al Pacino in The Devils Advocate

Problem with streamwriter_settings.ini

I assume, that you mean to add the following line to [FilesMove]:

streamwriter_settings.ini=%PAL:AppDir%\streamWriter

because the line

streamwriter_data.ini=%PAL:AppDir%\streamWriter

already is contained in the section [FilesMove].

Yes the entry "%PAL:AppDir%" in the file streamwriter_settings.ini is really wrong, which I can't solve. But how I mentioned, the user has at the first run of the app the possibility to determine a folder, in which the songs are saved. If the user for example choose the folder streamWriterPortable\Data\Downloads, then the following line appear in the file streamwriter_settings.ini:

Dir=X:\Portableapps\streamWriterPortable\Data\Downloads

The main problem occur in the case, if the user move to another PC. Probably the user again must determine a folder, in which the songs are saved. The reason is the change of the drive letter.

Furthermore I think it's the best to delete the complete section [FileWrite1] in the file streamwriter_settings.ini, because it isn't useful.

drive letter

The changing driveletter between PCs isnt a problem as the Launcher can handle that. In your streamWriterPortable.ini, the Dir is set to always be "%PAL:DataDir%\Downloads". If the user has set something different, he has a problem. So you either have to force the user to use that exact folder or change streamWriterPortable.ini so it only replaces the drive letter.

"What about Love?" - "Overrated. Biochemically no different than eating large quantities of chocolate." - Al Pacino in The Devils Advocate

Value in section [FileWrite1] not take over

The problem is, that the value "%PAL:DataDir%\Downloads" from the section [FileWrite1] don't take over in the file streamwriter_settings.ini.

What about if I now start to post the file streamWriterPortable_1.4.paf.exe in the Beta Forum?

then

there is something wrong with either the location of streamwriter_settings.ini or with the [FileWrite1].

You can of course post it and other can have a look at it.

"What about Love?" - "Overrated. Biochemically no different than eating large quantities of chocolate." - Al Pacino in The Devils Advocate

Alteration of the section [FileWrite1]

Surely is the reason for this problem mit high probability the section [FileWrite1].
But I have a idea. How I mentioned, it's only necessary, that the user at the first run of the app determine a folder at the flash drive, in which the songs are saved. Afterwards it's important, to find a solution for the change of the drive letter in the case, if the user moves to another PC.
What about with the following code in the section [FileWrite1]:

[FileWrite1]
Type=Replace
File=%PAL:DataDir%\Data\streamwriter_settings.ini
Find=%PAL:LastDrive%\
Replace=%PAL:Drive%\

File

Are you sure that thats where the file will be?
If there are more than one settings file, they are most commonly put inside a settings folder (/Data/settings).
And it should be %PAL:DataDir%\streamwriter_settings.ini.

"What about Love?" - "Overrated. Biochemically no different than eating large quantities of chocolate." - Al Pacino in The Devils Advocate

Sorry

Of course should the code in the section [FileWrite1] be as follows:

[FileWrite1]
Type=Replace
File=%PAL:DataDir%\streamwriter_settings.ini
Find=%PAL:LastDrive%\
Replace=%PAL:Drive%\

But really exist in the directory Data a subfolder called "settings". And in this subfolder reside a file named "streamWriterPortableSettings.ini" with the following content:

[streamWriterPortableSettings]
LastDrive=D: 

Therefore I think, that the content of the [FileWrite1] above maybe the solution.

Yes

The launcher creates that file by defau to keep track of the driveletter.

"What about Love?" - "Overrated. Biochemically no different than eating large quantities of chocolate." - Al Pacino in The Devils Advocate

Yes, that should do it. The

Yes, that should do it. The streamWriterPortableSettings.ini is created by the launcher and for now contains the value used for %PAL:LastDrive%. Try it on a flashdrive and see its value changing according to the drive letter.
-edit-
Zwei Doofe ein Gedanke, mal wieder. Sticking out tongue

Deletion of [FileWrite1]

Therefore I don't need such a [FileWrite1] and can delete it completely.

No! You need it! Just the

No!
You need it! Just the value that is written to streamwriter_settings.ini is based on that entry...