21
22
23
24
25
26
27
28
29
30
31
32
33
|
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
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
;;======================================================================
;;(use srfi-18 extras tcp s11n srfi-1 posix regex srfi-69 hostinfo md5
;; message-digest matchable spiffy uri-common intarweb http-client
;; spiffy-request-vars uri-common intarweb directory-utils)
(declare (unit clientmod))
(declare (uses servermod))
(declare (uses artifacts))
(module clientmod
*
(import scheme
posix
data-structures
srfi-18
artifacts
servermod
)
(define (client:find-server areapath)
(let* ((sdir (conc areapath"/.server"))
(sarfs (glob (conc sdir"/*.artifact")))) ;; server artifacts
(if (null? sarfs)
(begin
(server:launch areapath)
(thread-sleep! 1)
(client:find-server areapath))
(let* ((sarf (car sarfs))
(sdat (read-artifact->alist sarf))
(srvdir (alist-ref 'd sdat)))
srvdir))))
)
|