[PATCH] Final patch for File refactoring

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] Final patch for File refactoring

Paolo Bonzini-2
Here is the final patch that I had to apply to have clean make
distcheck.  There were some problems when `Directory systemKernel' was
not present on the system.  Previously it would return '' (on system
supporting relocatable installs, at least) and this broke with the new
patch.  Instead, now it returns nil.

I committed it together with the other patches as
c12efdf44899ae80a4c1a54ed99e4e2e25b897c1.

Paolo

diff --git a/kernel/Directory.st b/kernel/Directory.st
index 8661298..1b9f98b 100644
--- a/kernel/Directory.st
+++ b/kernel/Directory.st
@@ -71,6 +71,7 @@ virtual one).'>
  "Answer the path to GNU Smalltalk's dynamically loaded modules"
 
  <category: 'reading system defaults'>
+ ModulePath isNil ifTrue:[ ^nil ].
  ^File name: ModulePath
     ]
 
@@ -78,6 +79,7 @@ virtual one).'>
  "Answer the path to GNU Smalltalk's auxiliary executables"
 
  <category: 'reading system defaults'>
+ LibexecPath isNil ifTrue:[ ^nil ].
  ^File name: LibexecPath
     ]
 
@@ -85,6 +87,7 @@ virtual one).'>
  "Answer the path to the installed Smalltalk kernel source files."
 
  <category: 'reading system defaults'>
+ SystemKernelPath isNil ifTrue:[ ^nil ].
  ^File name: SystemKernelPath
     ]
 
diff --git a/libgst/dict.c b/libgst/dict.c
index 49903e7..7cd4f6f 100644
--- a/libgst/dict.c
+++ b/libgst/dict.c
@@ -1054,24 +1054,28 @@ add_smalltalk (const char *globalName,
   return globalValue;
 }
 
+static OOP
+relocate_path_oop (const char *s)
+{
+  OOP resultOOP;
+  char *path = _gst_relocate_path (s);
+  if (path)
+    resultOOP = _gst_string_new (path);
+  else
+    resultOOP = _gst_nil_oop;
+
+  free (path);
+  return resultOOP;
+}
+
 void
 init_runtime_objects (void)
 {
-  char *s;
   add_smalltalk ("UserFileBasePath", _gst_string_new (_gst_user_file_base_path));
 
-  s = _gst_relocate_path (KERNEL_PATH);
-  add_smalltalk ("SystemKernelPath", _gst_string_new (s));
-  free (s);
-
-  s = _gst_relocate_path (MODULE_PATH);
-  add_smalltalk ("ModulePath", _gst_string_new (s));
-  free (s);
-
-  s = _gst_relocate_path (LIBEXEC_PATH);
-  add_smalltalk ("LibexecPath", _gst_string_new (s));
-  free (s);
-
+  add_smalltalk ("SystemKernelPath", relocate_path_oop (KERNEL_PATH));
+  add_smalltalk ("ModulePath", relocate_path_oop (MODULE_PATH));
+  add_smalltalk ("LibexecPath", relocate_path_oop (LIBEXEC_PATH));
   add_smalltalk ("ImageFilePath", _gst_string_new (_gst_image_file_path));
   add_smalltalk ("ExecutableFileName", _gst_string_new (_gst_executable_path));
   add_smalltalk ("ImageFileName", _gst_string_new (_gst_binary_image_name));
diff --git a/packages/blox/tests/test.st b/packages/blox/tests/test.st
index 1d585c3..eb4494f 100644
--- a/packages/blox/tests/test.st
+++ b/packages/blox/tests/test.st
@@ -381,8 +381,7 @@ Gui class extend [
 
     validImageFile [
  <category: 'testing single controls'>
- ^FileStream open: Directory systemKernel , '/../blox/bear.gif'
-    mode: FileStream read
+ ^(Directory kernel / '../blox/bear.gif') readStream
     ]
 
     labelTest [
diff --git a/packages/httpd/WikiServer.st b/packages/httpd/WikiServer.st
index 67de862..c44c7b8 100644
--- a/packages/httpd/WikiServer.st
+++ b/packages/httpd/WikiServer.st
@@ -2296,8 +2296,10 @@ WebServer class extend [
 
     initializeImages [
  <category: 'examples'>
- (self at: 8080) handler addComponent: (FileWebServer named: 'images'
-    directory: Directory systemKernel / '../net/httpd')
+ (self at: 8080) handler addComponent:
+    (FileWebServer
+ named: 'images'
+ directory: (Directory kernel / '../WebServer.star') zip)
     ]
 
     initializeWiki [

_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk