Check-in [95376977d4]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Serve and create short cuts working.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:95376977d4fe0e86f2062fb0490783179073f546
User & Date: gwlester 2014-12-08 03:39:00
Context
2014-12-08
06:11
Put catch arround setting mtime -- newer versions of Android do not like it. check-in: 56100091ad user: gwlester tags: trunk
03:39
Serve and create short cuts working. check-in: 95376977d4 user: gwlester tags: trunk
03:06
Checkin check-in: e8be0b5c97 user: gwlester tags: trunk
Changes

Changes to CreateShortCuts.tcl.

21
22
23
24
25
26
27
28

29
30
31
32
33
34
35
36
37
38
39
40






41
42
43
44
45
46

47
48
49
50
51
52
53
    }
}

proc ListenForServer {socket} {
    global filesDownloaded

    set dataDict [read $socket]
    puts "Received {$dataDict}"

    if {[dict exists $dataDict port]} {
        set toPort [dict get $dataDict port]
        set host [dict get $dataDict host]
        set ::status "Sever '$host' found!  Requesting file list..."
        set url [format {http://%s:%d/ScriptSever} $host $toPort]
        set token [::http::geturl $url -query [::http::formatQuery COMMAND LIST]]
        ::http::wait $token
        if {[::http::status $token]} {
            set infoList [::http::data $token]
            ::http::cleanup $token
            foreach {fileName date} $infoList {
                if {![file exists $fileName] || ([file mtime $fileName] < $date)} {






                    set ::status "Downloading '$fileName'..."
                    set ofd [open $fileName w]
                    set query [::http::formatQuery COMMAND GET FILE $fileName]
                    set token [::http::geturl $url -query $query -channel $ofd]
                    ::http::wait $token
                    close $ofd

                    ::http::cleanup $token
                }
            }
        }
        set filesDownloaded 1
    }
}







|
>







|



|
>
>
>
>
>
>






>







21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
    }
}

proc ListenForServer {socket} {
    global filesDownloaded

    set dataDict [read $socket]
    fileevent $socket readable {}
    close $socket
    if {[dict exists $dataDict port]} {
        set toPort [dict get $dataDict port]
        set host [dict get $dataDict host]
        set ::status "Sever '$host' found!  Requesting file list..."
        set url [format {http://%s:%d/ScriptSever} $host $toPort]
        set token [::http::geturl $url -query [::http::formatQuery COMMAND LIST]]
        ::http::wait $token
        if {[::http::status $token] eq {ok}} {
            set infoList [::http::data $token]
            ::http::cleanup $token
            foreach {fileName date} $infoList {
		set fileExists [file exists $fileName]
                if {$fileExists} {
		    set fileMtime [file mtime $fileName]
		} else {
		    set fileMtime $date
		}
                if {!$fileExists || ($fileMtime < $date)} {
                    set ::status "Downloading '$fileName'..."
                    set ofd [open $fileName w]
                    set query [::http::formatQuery COMMAND GET FILE $fileName]
                    set token [::http::geturl $url -query $query -channel $ofd]
                    ::http::wait $token
                    close $ofd
		    file mtime $fileName $date
                    ::http::cleanup $token
                }
            }
        }
        set filesDownloaded 1
    }
}