Skip to content

Commit c87321e

Browse files
committed
CHANGE: deprecated system/options/module-paths replaced with system/options/modules
1 parent 19b88c0 commit c87321e

File tree

4 files changed

+34
-11
lines changed

4 files changed

+34
-11
lines changed

src/boot/sysobj.reb

+3-1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ options: object [ ; Options supplied to REBOL during startup
3333
boot: ; The path to the executable
3434
path: ; Where script was started or the startup dir
3535
home: ; Path of home directory
36+
data: ; Path of application data directory
37+
modules: ; Path of extension modules
3638
none
3739

3840
flags: ; Boot flag bits (see system/catalog/boot-flags)
@@ -51,7 +53,7 @@ options: object [ ; Options supplied to REBOL during startup
5153
binary-base: 16 ; Default base for FORMed binary values (64, 16, 2)
5254
decimal-digits: 15 ; Max number of decimal digits to print.
5355
probe-limit: 16000 ; Max probed output size
54-
module-paths: [%./]
56+
module-paths: none ;@@ DEPRECATED!
5557
default-suffix: %.reb ; Used by IMPORT if no suffix is provided
5658
file-types: []
5759
mime-types: none

src/mezz/sys-load.reb

+10-9
Original file line numberDiff line numberDiff line change
@@ -670,11 +670,14 @@ load-module: function [
670670
]
671671

672672
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]
678681
]
679682
none
680683
]
@@ -739,10 +742,8 @@ import: function [
739742
word? module [
740743
; Module (as word!) is not loaded already, so let's try to find it.
741744
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
746747
]
747748
unless name [
748749
; try to locate as an extension...

src/mezz/sys-start.reb

+16
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,21 @@ start: func [
9898
path ; Directory where we started (O: not sure with this one)
9999
]
100100

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+
101116
if file? script [ ; Get the path (needed for SECURE setup)
102117
script: any [to-real-file script script]
103118
script-path: split-path script
@@ -169,6 +184,7 @@ start: func [
169184
file throw
170185
(path) [allow read]
171186
(home) [allow read]
187+
(data) [allow read write]
172188
(first script-path) allow
173189
]
174190
]

src/tests/units/module-test.r3

+5-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ Rebol [
1010

1111
; extend module-paths with units/files/ directory
1212
; 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/
1415

1516

1617
===start-group=== "module keywords"
@@ -409,3 +410,6 @@ probe all [
409410

410411
~~~end-file~~~
411412

413+
;restore the original path
414+
system/options/modules: orig-modules-dir
415+

0 commit comments

Comments
 (0)