Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 70 lines (54 sloc) 1.925 kb
0f22048 @Pauan .
Pauan authored
1 ;(load:string %.exec-dir "lib/01 utils.arc")
2 ;(load:string %.exec-dir "lib/02 parameters.arc")
3 ;(load:string %.exec-dir "lib/03 paths.arc")
4960fb6 @Pauan .
Pauan authored
4 ;(load:string %.exec-dir "lib/04 namespaces.arc")
5
6
387b145 @Pauan Huge improvements to the app/playlist program
Pauan authored
7 (parameter debug? nil)
4960fb6 @Pauan .
Pauan authored
8
9 (redef debug args
10 (when debug?
387b145 @Pauan Huge improvements to the app/playlist program
Pauan authored
11 (apply prn args))) ;(intersperse " " )
4960fb6 @Pauan .
Pauan authored
12
13
14 (parameter import-dirs (list cwd
15 exec-dir
16 (exec-path "lib/")))
17 (parameter import-cache (hash (exec-path "02 arc.arc") t
18 (exec-path "lib/01 utils.arc") t
19 (exec-path "lib/02 parameters.arc") t
20 (exec-path "lib/03 paths.arc") t
21 (exec-path "lib/04 import.arc") t))
22 (parameter import-suffix ".arc")
23 (parameter import-loading nil)
24
25
26 (def import-file-dir (x)
27 (find [file-exists:path _ x] import-dirs))
28
29 (def import-normalize-path (x)
30 (if extension.x
31 x
32 (string x import-suffix)))
33
34 (def call-w/find-file (x f)
35 (parameterize (%.port-count-lines-enabled #t)
36 (let y import-normalize-path.x
c940847 @Pauan .
Pauan authored
37 (aif (import-file-dir y)
38 (f (path it y) y)
39 (and (isnt x y)
40 (import-file-dir x))
41 (f (path it x) x)
42 (err:string "file \"" x "\" was not found")))))
4960fb6 @Pauan .
Pauan authored
43
44
45 (def import-file (x)
46 (call-w/find-file string.x
47 (fn (path name)
48 (let path abspath.path
49 (if import-cache.path
387b145 @Pauan Huge improvements to the app/playlist program
Pauan authored
50 (debug " skipping: " name)
51 (do (debug " loading: " name)
4960fb6 @Pauan .
Pauan authored
52 (= import-cache.path t)
c940847 @Pauan .
Pauan authored
53 (w/import-loading t load.path)))))))
4960fb6 @Pauan .
Pauan authored
54
55 (def import-dir (x)
56 (push abspath.x import-dirs))
57
58 (def import1 (x)
59 (if basename.x
60 import-file.x
61 import-dir.x))
62
63 (mac import args
64 `(w/import-dirs import-dirs
65 (eachfn import1 ',args)))
66
67 (mac reimport args
68 `(w/import-cache (table)
69 (import ,args)))
Something went wrong with that request. Please try again.