source: sans/Dev/trunk/NCNR_User_Procedures/Common/Installer/CheckVersionFTP.ipf @ 769

Last change on this file since 769 was 769, checked in by srkline, 12 years ago

fixes to ILL DIV file loading

bug in GenCurveFit? being passed a null hold string

FTP check still not working

File size: 3.6 KB
Line 
1#pragma rtGlobals=1             // Use modern global access method.
2#pragma IgorVersion=6.1
3
4// goes to our ftp site and downloads "CurrentVersion.txt", puts this in "Packages"
5// in the WM preferences folder. I can write to it here, and it won't mess with any install
6//
7// compares to the installed version string, which is installed in UP:NCNR_UP
8//
9//
10//
11Proc CheckForLatestVersion()
12
13        String url = "ftp://ftp.ncnr.nist.gov/pub/sans/kline/CurrentVersion.txt"
14        String currentStr,installedStr,fileNameStr="",varStr="",str
15        Variable refNum,upToDateVersion,runningVersion
16       
17        fileNameStr = SpecialDirPath("Packages", 0, 0, 0)
18        fileNameStr += "CurrentVersion.txt"
19
20        FTPDownload/O/Z/V=7/T=1 url, fileNameStr
21
22        Open/R refNum as fileNameStr
23        FReadLine refNum, currentStr
24        Close refnum
25       
26        Print "Current = ",CurrentStr
27        // don't use the local strings anymore 
28//      setDataFolder root:
29//      varStr=VariableList("*VERSION",";",6)
30//      if(strlen(varStr)==0)
31//              SetDataFolder root:Packages:NIST:
32//              varStr=VariableList("*VERSION",";",6)
33//      endif
34//      if(strlen(varStr)==0)
35//              Abort "Can't find the local version number"
36//      Endif
37       
38        // find the installed version
39        PathInfo Igor
40        String IgorPathStr = S_Path
41        fileNameStr = IgorPathStr + "User Procedures:NCNR_User_Procedures:InstalledVersion.txt"
42       
43        // the Igor 6.1 User Procedure Path, same sub-folders as in Igor App Folder
44        String userPathStr=RemoveEnding(SpecialDirPath("Igor Pro User Files",0,0,0),":")+":"
45       
46        // try the UP folder in the Igor Pro folder (older installations)
47        Open/R/Z refNum as fileNameStr
48        if(V_flag != 0)
49                //then try the special user directory (for 6.1+ installations)
50                Open/R/Z refNum as userPathStr + "User Procedures:NCNR_User_Procedures:InstalledVersion.txt"
51                if(V_flag != 0)
52                        //couldn't find the file, send user to web site to update
53                        sprintf str,"I could not determine what version of the SANS Macros you are running."
54                        str += " You need to go to the NCNR website for the latest version. Do you want to go there now?"
55                        DoAlert 1,str
56                        if(V_flag==1)
57                                BrowseURL "http://www.ncnr.nist.gov/programs/sans/data/red_anal.html"
58                        endif
59                        //don't need to close if nothing was opened (/Z)
60                       
61                        return          //couldn't find either file, nothing opened, exit
62                endif
63        endif
64       
65        // the file was opened, check the version
66        FReadLine refNum, installedStr
67        Close refnum
68       
69        Print "Installed = ",installedStr       
70       
71        runningVersion = NumberByKey(StringFromList(0,"PACKAGE_VERSION"), installedStr,"=",";")
72        upToDateVersion = NumberByKey(StringFromList(0,"PACKAGE_VERSION"), currentStr,"=",";")
73       
74        If(runningVersion != upToDateVersion)
75                sprintf str,"You are running version %g and the latest version is %g.",runningVersion,upToDateVersion
76                str += " You need to go to the NCNR website for the latest version. Do you want to go there now?"
77                DoAlert 1,str
78                if(V_flag==1)
79                        BrowseURL "http://www.ncnr.nist.gov/programs/sans/data/red_anal.html"
80                endif
81        else
82                DoAlert 0,"You are running the most up-to-date version = "+StringByKey(StringFromList(0,"PACKAGE_VERSION"), currentStr,"=",";")
83        endif
84       
85        return
86End
87
88Function OpenTracTicketPage()
89        DoAlert 1,"Your web browser will open to a page where you can submit your bug report or feature request. OK?"
90        if(V_flag==1)
91                BrowseURL "http://danse.chem.utk.edu/trac/newticket"
92        endif
93End
94
95Function OpenHelpMoviePage()
96        DoAlert 1,"Your web browser will open to a page where you can view help movies. OK? (You must have QuickTime installed)"
97        if(V_flag==1)
98//              BrowseURL "ftp://webster.ncnr.nist.gov/pub/sans/kline/movies/"
99                // Andrew has set up a http page too. Try to use this in the future
100                BrowseURL "http://www.ncnr.nist.gov/programs/sans/data/movies/reduction_analysis_movies.html"
101        endif
102End
Note: See TracBrowser for help on using the repository browser.