Get the new PortableApps.com Platform 10.0: Gorgeous themes, a full portable app store and advanced functionality
Announcing the World's Best Flash Drive: The PortableApps.com Companion | Did you see a malware warning on Friday?

I can't include the Data directory's files while compiling the installer.

domecc - September 18, 2009 - 12:40pm

When I compiled the installer by PortableApps.com_Installer_0.13.3, it can only include the App directory, but not the Data directory's files.

What should I do?


( categories: )

Live Support Chat

[01:32] <+OliverK> that should be handled by the launcher, not the installer
[01:33] <+OliverK> place settings.ini in App\DefaultData, and then have the launcher (at first run) copy it to data\settings
[01:43] Thanks!

Thats on purpose

If you are building an installer, the Data directory is always empty. That's so already existing user files ion that folder aren't overwritten.

If you want files to appear inside the data folder, use a DefaultData folder inside the App folder and copy them on first launch.

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

I've code such

I've code such as:

IfFileExists $EXEDIR\Data\settings\Settings.ini ""
CopyFiles /SILENT $EXEDIR\App\DefaultData\*.* $EXEDIR\Data\

But, the launcher copy the settings.ini each time.
How can I make it only the first time?

I've read the NSIS help about IfFileExists, but couldn't find what is wrong.

You should probably use HM

You should probably use HM NIS Edit to help if you don't understand the params of certain functions, not only is the interface intuitive and helpful, so is there help.

On to your question:

The parameters of IfFileExists are as such:

IfFileExists

So in your case, you'd want so use this:


IfFileExists $EXEDIR\Data\settings\Settings.ini "" SettingsExist
CopyFiles /SILENT $EXEDIR\App\DefaultData\*.* $EXEDIR\Data\

With SettingsExist being the next function that the launcher should go to, if the settings do in fact exist.

-Gizmokid2005

I know

I type too slow Smiling

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

Yes

You use the code the wrong way:
If the file exists, it jumps to the place specified after the file. In your case that is "" which is the next line so the file gets copied no matter what.

Use something like:

	CheckForSettings:
		IfFileExists $EXEDIR\Data\settings\Settings.ini SettingsFound
		;=== No settings found
		CopyFiles /SILENT $EXEDIR\App\DefaultData\*.* $EXEDIR\Data\
		GoTo SettingsFound

	SettingsFound:
		continue here with your code

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

Yes, as Simeon said...I

Yes, as Simeon said...I reversed my code, his is correct.

Thanks very much! It's so

Thanks very much! It's so brevity.

I try again and again, and found my another error: there must be a blank line before lable.......

  	IfFileExists $EXEDIR\Data\settings\Settings.ini YesSetting NoSetting
	YesSetting:
		;MessageBox MB_OK "YesSetting"
		Goto SettingsExist
		
	NoSetting:
		;MessageBox MB_OK "NoSetting"
		CopyFiles /SILENT $EXEDIR\App\DefaultData\*.* $EXEDIR\Data\
		
	SettingsExist:
		;MessageBox MB_OK "SettingsExist"

You can actually do this, its

You can actually do this, its smaller and cleaner:

  	IfFileExists $EXEDIR\Data\settings\Settings.ini SettingsExist
	CopyFiles /SILENT $EXEDIR\App\DefaultData\*.* $EXEDIR\Data\
		
	SettingsExist:
		;MessageBox MB_OK "SettingsExist"

Smiling

And havein gNoSettings: Would

And having NoSettings: would cause the compiler to complain. Not deadly, but in good standards it is.

Too many lonely hearts in the real world
Too many bridges you can burn
Too many tables you can't turn
Don't wanna live my life in the real world

Cool! Thanks!!

Cool! Thanks!!