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

Last change on this file since 1132 was 1132, checked in by srkline, 4 years ago

redirecting the update version page to the trac page rather than the NCNR page for the latest updates

still need to update the "current version" file which is located on webster.

File size: 3.9 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                        str += " You need to go to the SANS Trac website for the latest version. Do you want to go there now?"
56                        DoAlert 1,str
57                        if(V_flag==1)
58//                              BrowseURL "http://www.ncnr.nist.gov/programs/sans/data/red_anal.html"
59                                BrowseURL "http://danse.chem.utk.edu/trac/wiki"
60                        endif
61                        //don't need to close if nothing was opened (/Z)
62                       
63                        return          //couldn't find either file, nothing opened, exit
64                endif
65        endif
66       
67        // the file was opened, check the version
68        FReadLine refNum, installedStr
69        Close refnum
70       
71        Print "Installed = ",installedStr       
72       
73        runningVersion = NumberByKey(StringFromList(0,"PACKAGE_VERSION"), installedStr,"=",";")
74        upToDateVersion = NumberByKey(StringFromList(0,"PACKAGE_VERSION"), currentStr,"=",";")
75       
76        If(runningVersion != upToDateVersion)
77                sprintf str,"You are running version %g and the latest version is %g.",runningVersion,upToDateVersion
78//              str += " You need to go to the NCNR website for the latest version. Do you want to go there now?"
79                str += " You need to go to the SANS Trac website for the latest version. Do you want to go there now?"
80                DoAlert 1,str
81                if(V_flag==1)
82//                      BrowseURL "http://www.ncnr.nist.gov/programs/sans/data/red_anal.html"
83                        BrowseURL "http://danse.chem.utk.edu/trac/wiki"
84                endif
85        else
86                DoAlert 0,"You are running the most up-to-date version = "+StringByKey(StringFromList(0,"PACKAGE_VERSION"), currentStr,"=",";")
87        endif
88       
89        return
90End
91
92Function OpenTracTicketPage()
93        DoAlert 1,"Your web browser will open to a page where you can submit your bug report or feature request. OK?"
94        if(V_flag==1)
95                BrowseURL "http://danse.chem.utk.edu/trac/newticket"
96        endif
97End
98
99Function OpenHelpMoviePage()
100        DoAlert 1,"Your web browser will open to a page where you can view help movies. OK?"
101        if(V_flag==1)
102//              BrowseURL "ftp://webster.ncnr.nist.gov/pub/sans/kline/movies/"
103                // Andrew has set up a http page too. Try to use this in the future
104                BrowseURL "http://www.ncnr.nist.gov/programs/sans/data/movies/reduction_analysis_movies.html"
105        endif
106End
Note: See TracBrowser for help on using the repository browser.