#pragma rtGlobals=1 // Use modern global access method. #pragma IgorVersion=6.1 /// // *********** // it may be prefereable to COPY the files to the UP folder, so that the installer doesn't "eat" itself // and require users to re-download if they do something wrong. the difficulty with CopyFolder is that // on Windows it does a "mix-in" copy, rather than a delete/overwrite all. So it may be better to just leave // the installer as is, requiring a fresh copy each time. SRK 10MAR09 // // /// // Install the NCNR Macros //InstallNCNRMacros() // run this function when experiment is loaded //InstallerPanel() // run this function when experiment is loaded // // package-6.001 // - lots more diagnostics added Function InstallNCNRMacros(forceInstall) Variable forceInstall // if == 1, install whatever possible, even if R/W errors from the OS //first step, check for Igor 6!!! if(NumberByKey("IGORVERS", IgorInfo(0)) < 6) Abort "You must be running Igor 6 or later to use these macros." endif // check to see if the installer has already been run... if so, the folders will be gone... stop now BEFORE removing things String test = IndexedDir(home, -1, 0) if(stringmatch(test, "*NCNR_User_Procedures*") == 0) print test Abort "You've already run the installer. If you want to re-install, you'll need a fresh copy from the NCNR website." endif // check for install problems // locked folders, OS errors _err will be non-zero if there is an error Variable UP_err,IH_err,IE_err UP_err = FolderPermissionCheck("User Procedures:") IH_err = FolderPermissionCheck("Igor Help Files:") IE_err = FolderPermissionCheck("Igor Extensions:") // Print UP_err,IH_err,IE_err String alertStr="" if(UP_err != 0) alertStr += "User Procedures has no write permission.\r" endif if(IH_err != 0) alertStr += "Igor Help Files has no write permission.\r" endif if(IE_err != 0) alertStr += "Igor Extensions has no write permission.\r" endif if(forceInstall == 0) if(UP_err != 0 || IH_err != 0 || IE_err != 0) alertStr += "You will need to install manually." DoAlert 0,alertStr return(0) endif endif // check the platform Variable isMac=0 if(cmpstr("Macintosh",IgorInfo(2))==0) isMac=1 endif String igorPathStr,homePathStr PathInfo Igor igorPathStr = S_Path //these have trailing colons PathInfo home //the location where this was run from... homePathStr = S_Path // clean up old stuff, moving to home:old_moved_files // extensions - these show up as files, even the aliases // help files - these are files // user procedures - these can be in folders or as files variable i=0, AliasSet=0, isThere = 0 String tmpStr // clean up the Igor Extensions NewPath /Q/O ExPath, igorPathStr+"Igor Extensions:" PathInfo ExPath String extPathStr = S_Path string strFileList = IndexedFile(ExPath, -1, "????" ) Wave/T extFiles=root:IExtFiles for (i=0; i