File tree 4 files changed +34
-11
lines changed
4 files changed +34
-11
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,8 @@ options: object [ ; Options supplied to REBOL during startup
33
33
boot: ; The path to the executable
34
34
path: ; Where script was started or the startup dir
35
35
home: ; Path of home directory
36
+ data: ; Path of application data directory
37
+ modules: ; Path of extension modules
36
38
none
37
39
38
40
flags: ; Boot flag bits (see system/catalog/boot-flags)
@@ -51,7 +53,7 @@ options: object [ ; Options supplied to REBOL during startup
51
53
binary-base: 16 ; Default base for FORMed binary values (64, 16, 2)
52
54
decimal-digits: 15 ; Max number of decimal digits to print.
53
55
probe-limit: 16000 ; Max probed output size
54
- module-paths: [ %./ ]
56
+ module-paths: none ;@@ DEPRECATED!
55
57
default-suffix: %.reb ; Used by IMPORT if no suffix is provided
56
58
file-types: []
57
59
mime-types: none
Original file line number Diff line number Diff line change @@ -670,11 +670,14 @@ load-module: function [
670
670
]
671
671
672
672
locate-extension : function [ name [word! ]] [
673
- foreach path system/options/module-paths [
674
- file: append to file! name %.rebx
675
- if exists? path/: file [ return path/: file ]
676
- file: repend to file! name [#"-" system/build/os #"-" system/build/arch %.rebx ]
677
- if exists? path/: file [ return path/: file ]
673
+ path: system/options/modules
674
+ foreach test [
675
+ [path name %.rebx ]
676
+ [path name #"-" system/build/arch %.rebx ]
677
+ [path name #"-" system/build/os #"-" system/build/arch %.rebx ]
678
+ ][
679
+ if exists? file: as file! ajoin test [return file]
680
+ sys/log/debug 'REBOL ["Not found extension file:" file]
678
681
]
679
682
none
680
683
]
@@ -739,10 +742,8 @@ import: function [
739
742
word? module [
740
743
; Module (as word!) is not loaded already, so let's try to find it.
741
744
file: append to file! module system/options/default-suffix
742
- foreach path system/options/module-paths [
743
- if set [name: mod: ] apply :load-module [
744
- path/: file version ver check sum no-share no-lib /import /as module
745
- ] [break]
745
+ set [name: mod: ] apply :load-module [
746
+ system/options/modules/: file version ver check sum no-share no-lib /import /as module
746
747
]
747
748
unless name [
748
749
; try to locate as an extension...
Original file line number Diff line number Diff line change @@ -98,6 +98,21 @@ start: func [
98
98
path ; Directory where we started (O: not sure with this one)
99
99
]
100
100
101
+ ;- 4. /data - directory of any application data (modules, cache...)
102
+ data: either system/platform = 'Windows [
103
+ append dirize to-rebol-file any [get-env "APPDATA" home] %Rebol/
104
+ ][ append copy home %.rebol/ ]
105
+
106
+ ;- 5. /modules - directory of extension module files
107
+ modules: append copy data %modules/
108
+
109
+ ;; for now keep the old `module-paths`, but let user know, that it's deprecated now!
110
+ module-paths : does [
111
+ sys/log/error 'REBOL "`system/options/module-paths` is deprecated and will be removed!"
112
+ sys/log/error 'REBOL "Use `system/options/modules` as a path to the directory instead!"
113
+ self/module-paths: reduce [modules]
114
+ ]
115
+
101
116
if file? script [ ; Get the path (needed for SECURE setup)
102
117
script: any [to-real-file script script]
103
118
script-path: split-path script
@@ -169,6 +184,7 @@ start: func [
169
184
file throw
170
185
(path) [allow read]
171
186
(home) [allow read]
187
+ (data) [allow read write]
172
188
(first script-path) allow
173
189
]
174
190
]
Original file line number Diff line number Diff line change @@ -10,7 +10,8 @@ Rebol [
10
10
11
11
; extend module-paths with units/files/ directory
12
12
; so modules there can be located
13
- supplement system/options/module-paths join what-dir %units/files/
13
+ orig-modules-dir: system/options/modules
14
+ system/options/modules: join what-dir %units/files/
14
15
15
16
16
17
===start-group=== "module keywords"
@@ -409,3 +410,6 @@ probe all [
409
410
410
411
~~~end-file~~~
411
412
413
+ ;restore the original path
414
+ system/options/modules: orig-modules-dir
415
+
You can’t perform that action at this time.
0 commit comments