#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 // FEB 2010 - now make use of the user-specific procedure path. It's always writeable, and not in the application folder // // since old material may be installed, and permission may be gone: // - check for permission // - check for old material installed in Igor Pro/ // -- if nothing installed in Igor Pro/, then permissions are not a problem // -- install in the new uer-specific path as intended // // -- now I need to search both locations to move old stuff out // -- then install clean into the new user path (userPathStr) // // ** The NCNR_Package_Loader is now installed in the Igor Procedures folder so that the package can be loaded at any time // improving compatibility with Jan Ilavsky's package // 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 "In install ", 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 /// SRK - 2010 - errors are not used here. instead, errors are caught if a file or folder move fails. If there // is nothing to move out, or it moves out OK, then permissions don't matter. // 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,userPathStr PathInfo Igor igorPathStr = S_Path //these have trailing colons PathInfo home //the location where this was run from... homePathStr = S_Path // the Igor 6.1 User Procedure Path, same sub-folders as in Igor App Folder userPathStr=RemoveEnding(SpecialDirPath("Igor Pro User Files",0,0,0),":")+":" // 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 String timeStamp = "_"+num2istr(datetime) ////////////////////////////////////////////////////////////////////// ////// clean up the Igor Extensions (first the old path -- in the App folder) NewPath /Q/O ExPath, igorPathStr+"Igor Extensions:" PathInfo ExPath String extPathStr = S_Path string strFileList = IndexedFile(ExPath, -1, "????" ) //files first Wave/T extFiles=root:IExtFiles for (i=0; i