You are here

Need help for [FileWriteN]

3 posts / 0 new
Last post
rdd
rdd's picture
Offline
Last seen: 1 week 14 hours ago
Translator
Joined: 2013-03-22 06:59
Need help for [FileWriteN]

Sorry if I post in wrong forum page.

I need help for [FileWriteN]. I'm working on a app based on old version of XAMPP and I need to edit about 45 files to make it portable. At this time I found that I must have 4 [FileWriteN] for every file, which will about 180 total entries (the last will be [FileWrite180]). So is there any elegant way to do this? Also i'm not sure is that the proper way, but I found that this work at this time. This is an example for one of the files:

[FileWrite5]
Type=Replace
File=%PAL:AppDir%\IcarTest\apache\bin\apr-1-config.bat
Find=C:\IcarTest_xampp
Replace=%PAL:AppDir%\IcarTest

[FileWrite6]
Type=Replace
File=%PAL:AppDir%\IcarTest\apache\bin\apr-1-config.bat
Find=%PAL:LastDrive%%PAL:LastPackagePartialDir%
Replace=%PAL:Drive%%PAL:PackagePartialDir%

[FileWrite7]
Type=Replace
File=%PAL:AppDir%\IcarTest\apache\bin\apr-1-config.bat
Find=%PAL:LastPortableAppsBaseDir%
Replace=%PAL:LastPortableAppsBaseDir%

[FileWrite8]
Type=Replace
File=%PAL:AppDir%\IcarTest\apache\bin\apr-1-config.bat
Find=%PAL:LastDrive%
Replace=%PAL:Drive%

In every file I must find and replace the C:\IcarTest_xampp

3D1T0R
3D1T0R's picture
Online
Last seen: 52 min ago
Developer
Joined: 2006-12-29 23:48
Relative paths?

You wouldn't need all of those [FileWriteN]s if you could use relative paths. Have you checked to see if you can manually replace some(or all) of them once with relative paths, which then won't need to be updated every time the app is run?

Also, do you have to change "C:\IcarTest_xampp" to "%PAL:AppDir%\IcarTest" every time you run the app, or just on first run?

~3D1T0R

richo
richo's picture
Offline
Last seen: 11 hours 56 min ago
Joined: 2007-01-31 22:03
XAMPP

XAMPP is already portable and has a script that can be run if you need to update paths due to not being installed to somewhere like X:\xampp (where X: can be any drive)

I haven't used XAMPP in quite some time, so I forget what the filename is for the script. However, I do remember that by default all the paths are set to something like \xampp as the base relative path (in the zip package, not the installer)

Though, for this script to work correctly you'll probably have to restore the paths to the default if you decide to incorporate using the script in the app you're working on.

Log in or register to post comments