File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed
Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -691,6 +691,16 @@ etc_getgrent(VALUE obj)
691691VALUE rb_w32_special_folder (int type );
692692UINT rb_w32_system_tmpdir (WCHAR * path , UINT len );
693693VALUE rb_w32_conv_from_wchar (const WCHAR * wstr , rb_encoding * enc );
694+ #elif defined(LOAD_RELATIVE )
695+ static inline VALUE
696+ rbconfig (void )
697+ {
698+ VALUE config ;
699+ rb_require ("rbconfig" );
700+ config = rb_const_get (rb_path2class ("RbConfig" ), rb_intern ("CONFIG" ));
701+ Check_Type (config , T_HASH );
702+ return config ;
703+ }
694704#endif
695705
696706/* call-seq:
@@ -710,6 +720,8 @@ etc_sysconfdir(VALUE obj)
710720{
711721#ifdef _WIN32
712722 return rb_w32_special_folder (CSIDL_COMMON_APPDATA );
723+ #elif defined(LOAD_RELATIVE )
724+ return rb_hash_aref (rbconfig (), rb_str_new_lit ("sysconfdir" ));
713725#else
714726 return rb_filesystem_str_new_cstr (SYSCONFDIR );
715727#endif
Original file line number Diff line number Diff line change @@ -169,6 +169,10 @@ def test_nprocessors
169169 assert_operator ( 1 , :<= , n )
170170 end
171171
172+ def test_sysconfdir
173+ assert_operator ( File , :absolute_path? , Etc . sysconfdir )
174+ end if File . method_defined? ( :absolute_path? )
175+
172176 def test_ractor
173177 return unless Etc . passwd # => skip test if no platform support
174178 Etc . endpwent
You can’t perform that action at this time.
0 commit comments