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

attempt to install to a ReadOnly disk


1 reply to this topic

alikza

alikza
  • Members
  • 4 posts

Posted 03 July 2002 - 15:31

Standard project 7.02 W2k sp2.

I want to display a messageBox to tell which path is used
(INSTALLDIR)when the user attempt to install on a readOnly
disk or directory. Now the path to the readOnly disk is ignored
without any message and the default path is used.
But I think the user should be informed about it.
How can I make this?
Thanks a lot!
 
???

CodeSkunk

CodeSkunk
  • Members
  • 9 posts

Posted 16 July 2002 - 19:35

If there is a better way to do this, I don't know it and this method seems to work nicely for me.
I Hope this helps.

1.  Create a new property called "IsReadOnlyPath" and set it to True.  Create a new property called "TMP_INSTALLDIR" and set it to [INSTALLDIR]

2.  Create a custom action in JScript or VBScript to check if the path is read only.  For this sample we can call it "CheckReadOnlyPath" which will set the "IsReadOnlyPath" property created in step 1.  
In addition to this, it will set INSTALLDIR from TMP_INSTALLDIR only if the path is writable.

3.  Edit the "ChangeFolder/SpawnDialog" PushButton event for the Destination Folder dialog from INSTALLDIR to TMP_INSTALLDIR

3.  Edit the "Next" PushButton events for the Destination Folder dialog to the following (in this order)

using the form:Event,Argument,Condition
---------------------------------------------
DoAction, CheckReadOnlyPath, 1
[ErrorDialog_Text],The path sucks!,IsReadOnlyPath="True"
SpawnDialog,ErrorDialog,IsReadOnlyPath="True"
NewDialog,ReadyToInstall,IsReadOnlyPath="False"

This should do the trick for you.

PS:  Here is a little JScript sample to get you started on the custom action.

Code Sample

//-------------------------------------------------------
// function: CheckReadOnlyPath()
//-------------------------------------------------------
function CheckReadOnlyPath()
{
  var oFSO = new ActiveXObject( "Scripting.FileSystemObject" );
  var sPath = Session.Property( "TMP_INSTALLDIR" );

  //make sure no final backslash on TMP_INSTALLDIR path
  var oRe = /\\$/g;
  sPath = sPath.replace(oRe, "") );

  //First blindly delete any pre-existing folder by that name.
  //don't care about errors on this first call
  try
  {
      oFSO.DeleteFolder( sPath + "\\" + "Check" );  
  }
  catch( e )
  {
  }

  try
  {
       oFSO.CreateFolder( sPath + "\\" + "Check" );
       oFSO.DeleteFolder( sPath + "\\" + "Check" );
       Session.Property( "IsReadOnlyPath" ) = "False"
       
       Session.Property( "INSTALLDIR" ) =         Session.Property( "TMP_INSTALLDIR" )
  }
  catch( e )
  {  
        Session.Property( "IsReadOnlyPath" ) = "True"
  }
  oFSO = null;
}

CodeSkunk
Sr. Propeller Head
~Making windows my b**ch since '93