You are here

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

12 posts / 0 new
Last post
domecc
Offline
Last seen: 14 years 3 months ago
Joined: 2009-03-09 10:28
I can't include the Data directory's files while compiling the installer.

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?

domecc
Offline
Last seen: 14 years 3 months ago
Joined: 2009-03-09 10:28
Live Support Chat

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

Simeon
Simeon's picture
Offline
Last seen: 10 years 2 months ago
DeveloperTranslator
Joined: 2006-09-25 15:15
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

domecc
Offline
Last seen: 14 years 3 months ago
Joined: 2009-03-09 10:28
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.

Gizmokid2005
Gizmokid2005's picture
Offline
Last seen: 1 month 2 weeks ago
Developer
Joined: 2007-01-17 19:24
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

Simeon
Simeon's picture
Offline
Last seen: 10 years 2 months ago
DeveloperTranslator
Joined: 2006-09-25 15:15
I know

I type too slow Smile

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

Simeon
Simeon's picture
Offline
Last seen: 10 years 2 months ago
DeveloperTranslator
Joined: 2006-09-25 15:15
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

Gizmokid2005
Gizmokid2005's picture
Offline
Last seen: 1 month 2 weeks ago
Developer
Joined: 2007-01-17 19:24
Yes, as Simeon said...I

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

domecc
Offline
Last seen: 14 years 3 months ago
Joined: 2009-03-09 10:28
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"
Gizmokid2005
Gizmokid2005's picture
Offline
Last seen: 1 month 2 weeks ago
Developer
Joined: 2007-01-17 19:24
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"

Smile

OliverK
OliverK's picture
Offline
Last seen: 3 years 6 months ago
Developer
Joined: 2007-03-27 15:21
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

domecc
Offline
Last seen: 14 years 3 months ago
Joined: 2009-03-09 10:28
Cool! Thanks!!

Cool! Thanks!!

Log in or register to post comments