Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Debug vs Install


1 reply to this topic

olsen

olsen
  • Full Members
  • 21 posts

Posted 28 November 2006 - 11:37

When I debud my program everything works perfectly.
But when I try to install it, something goes wrong.
A problem is that an ini-file (desktop.ini) is not created, as it's supposed to, and therefore does not change the icon on my folders..

My code:

function vIconOnFolder()
NUMBER hFile;
begin
OpenFileMode(FILE_MODE_APPEND);
CreateFile(hFile,INSTALLDIR^"Sys", "desktop.ini");
WriteProfString(INSTALLDIR^"Sys\\desktop.ini", ".ShellClassInfo", "ConfirmFileOp", "0");
WriteProfString(INSTALLDIR^"Sys\\desktop.ini", ".ShellClassInfo", "NoSharing", "1");
WriteProfString(INSTALLDIR^"Sys\\desktop.ini", ".ShellClassInfo", "IconFile", sSysFiles^"project.ico");
WriteProfString(INSTALLDIR^"Sys\\desktop.ini", ".ShellClassInfo", "IconIndex", "0");
WriteProfString(INSTALLDIR^"Sys\\desktop.ini", ".ShellClassInfo", "InforTip", "Project folder");
CloseFile(hFile);

LaunchAppAndWait("cmd.exe", "/c ATTRIB +S " + sProjectFiles, NOWAIT|LAAW_OPTION_HIDDEN);
XCopyFile(INSTALLDIR^"Sys\\desktop.ini", sProjectFiles, INCLUDE_SUBDIR);

vLog("Set icon " + sSysFiles^".ico to " + sProjectFiles);

OpenFile(hFile,INSTALLDIR^"Sys", "desktop.ini");
WriteProfString(INSTALLDIR^"Sys\\desktop.ini", ".ShellClassInfo", "IconFile", sSysFiles^"open.ico");
WriteProfString(INSTALLDIR^"Sys\\desktop.ini", ".ShellClassInfo", "InforTip", "User folder"); CloseFile(hFile);

LaunchAppAndWait("cmd.exe", "/c ATTRIB +S " + sUserFiles, NOWAIT|LAAW_OPTION_HIDDEN);
XCopyFile(INSTALLDIR^"Sys\\desktop.ini", sUserFiles, INCLUDE_SUBDIR);

DeleteFile(INSTALLDIR^"Sys\\desktop.ini");
end;

Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 28 November 2006 - 17:51

Use WriteProfString with empty arguments to flush the file to disk, as described in the help, before you change its attributes or copy it.