You are here

[DirectoriesToPreserve] Don't work for me

2 posts / 0 new
Last post
Makazzz
Makazzz's picture
Offline
Last seen: 2 years 2 months ago
Joined: 2019-04-30 15:58
[DirectoriesToPreserve] Don't work for me

Error picture
I tried at least 100 times for a solution but nothing seem to work... I am working on VSCode Portable online install without command line but with portable mode. I tried to copy the directory of App\VSCode\data with a custom code after install for not having it in the paf.exe directly and because it will try to replace it but same thing happen. I don't know what to do anymore and moving the data folder around is not a solution (I tried) and remove the purpose of not using command line. Even using the "Rename" command (for moving directory around) with nsh custom code break the data folder or do nothing.

installer.ini | This is for download and preserve the data folder but the [DirectoriesToPreserve] is not preserving the data but "try to open it" like a file (see Error picture) and every data is gone.
[DownloadFiles]
DownloadURL=https://go.microsoft.com/fwlink/?LinkID=623231
DownloadName=Visual Studio Code - Latest 32bit
DownloadFilename=VSCode-win32-ia32-x.x.x.zip
AdvancedExtract1To=App\VSCode
AdvancedExtract1Filter=**
AdditionalInstallSize=200000
;Download2URL=https://go.microsoft.com/fwlink/?Linkid=850641
;Download2Name=Visual Studio Code - Latest 64bit
;Download2Filename=VSCode-win32-x64-x.x.x.zip
;Download2AdvancedExtract1To=App\VSCode64
;Download2AdvancedExtract1Filter=**
;AdditionalInstallSize=500000

[DirectoriesToPreserve]
PreserveDirectory1=App\VSCode\data

PortableApps.comInstallerCustom.nsh | This will copy the data folder from bin to VSCode after the first install.
Var CustomFirstRunDone
!macro CustomCodePreInstall
ReadINIStr $0 "$INSTDIR\Data\settings\VSCodePortableFirstRun.ini" "FirstRun" "Done"
${If} $0 != true
ClearErrors
StrCpy $CustomFirstRunDone true
${EndIf}
!macroend
!macro CustomCodePostInstall
${If} $CustomFirstRunDone == true
CreateDirectory $INSTDIR\Data\settings
CopyFiles /SILENT $INSTDIR\App\DefaultData\Readme.txt $INSTDIR\Data
CopyFiles /SILENT $INSTDIR\App\bin\*.* $INSTDIR\App\VSCode
WriteINIStr "$INSTDIR\Data\settings\VSCodePortableFirstRun.ini" "FirstRun" "Done" "true"
${EndIf}
!macroend

Any help will be appriciated thanks.

EDIT: Finally I used command line argurment and not the portable mode anymore. So the problem still exist.

mwayne
Online
Last seen: 23 min 24 sec ago
Developer
Joined: 2012-01-03 09:23
Weird

I encountered this error message a couple of times too.

It's really weird that it tries to overwrite files that are deleted before.

To be save you should add the option:
[MainDirectories]
RemoveAppDirectory=false

Log in or register to post comments