|
@@ -38839,15 +38839,15 @@ return smalltalk.withContext(function($ctx1) {
|
|
|
var $2,$1;
|
|
|
$2=self["@basePath"];
|
|
|
if(($receiver = $2) == nil || $receiver == null){
|
|
|
-$1="./";
|
|
|
+$1=_st(self._class())._defaultBasePath();
|
|
|
} else {
|
|
|
$1=$2;
|
|
|
};
|
|
|
return $1;
|
|
|
}, function($ctx1) {$ctx1.fill(self,"basePath",{},smalltalk.FileServer)})},
|
|
|
args: [],
|
|
|
-source: "basePath\x0a\x09^basePath ifNil: ['./']",
|
|
|
-messageSends: ["ifNil:"],
|
|
|
+source: "basePath\x0a\x09^basePath ifNil: [self class defaultBasePath]",
|
|
|
+messageSends: ["ifNil:", "defaultBasePath", "class"],
|
|
|
referencedClasses: []
|
|
|
}),
|
|
|
smalltalk.FileServer);
|
|
@@ -38860,10 +38860,11 @@ fn: function (aString){
|
|
|
var self=this;
|
|
|
return smalltalk.withContext(function($ctx1) {
|
|
|
self["@basePath"]=aString;
|
|
|
+self._validateBasePath();
|
|
|
return self}, function($ctx1) {$ctx1.fill(self,"basePath:",{aString:aString},smalltalk.FileServer)})},
|
|
|
args: ["aString"],
|
|
|
-source: "basePath: aString\x0a\x09basePath := aString",
|
|
|
-messageSends: [],
|
|
|
+source: "basePath: aString\x0a\x09basePath := aString.\x0a\x09self validateBasePath.",
|
|
|
+messageSends: ["validateBasePath"],
|
|
|
referencedClasses: []
|
|
|
}),
|
|
|
smalltalk.FileServer);
|
|
@@ -39551,6 +39552,47 @@ referencedClasses: []
|
|
|
}),
|
|
|
smalltalk.FileServer);
|
|
|
|
|
|
+smalltalk.addMethod(
|
|
|
+smalltalk.method({
|
|
|
+selector: "validateBasePath",
|
|
|
+protocol: 'private',
|
|
|
+fn: function (){
|
|
|
+var self=this;
|
|
|
+return smalltalk.withContext(function($ctx1) {
|
|
|
+var $1,$2,$3,$4,$7,$6,$5,$8,$9;
|
|
|
+$1=self["@fs"];
|
|
|
+$2=self._basePath();
|
|
|
+$ctx1.sendIdx["basePath"]=1;
|
|
|
+_st($1)._stat_then_($2,(function(err,stat){
|
|
|
+return smalltalk.withContext(function($ctx2) {
|
|
|
+if(($receiver = err) == nil || $receiver == null){
|
|
|
+$3=_st(stat)._isDirectory();
|
|
|
+if(! smalltalk.assert($3)){
|
|
|
+$4=console;
|
|
|
+$7=self._basePath();
|
|
|
+$ctx2.sendIdx["basePath"]=2;
|
|
|
+$6="Warning: --base-path parameter ".__comma($7);
|
|
|
+$ctx2.sendIdx[","]=2;
|
|
|
+$5=_st($6).__comma(" is not a directory.");
|
|
|
+$ctx2.sendIdx[","]=1;
|
|
|
+return _st($4)._warn_($5);
|
|
|
+$ctx2.sendIdx["warn:"]=1;
|
|
|
+};
|
|
|
+} else {
|
|
|
+$8=console;
|
|
|
+$9=_st("Warning: path at --base-path parameter ".__comma(self._basePath())).__comma(" does not exist.");
|
|
|
+$ctx2.sendIdx[","]=3;
|
|
|
+return _st($8)._warn_($9);
|
|
|
+};
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({err:err,stat:stat},$ctx1,1)})}));
|
|
|
+return self}, function($ctx1) {$ctx1.fill(self,"validateBasePath",{},smalltalk.FileServer)})},
|
|
|
+args: [],
|
|
|
+source: "validateBasePath\x0a\x09\x22The basePath must be an existing directory. \x22\x0a\x09fs stat: self basePath then: [ :err :stat | err\x0a\x09\x09ifNil: [ stat isDirectory ifFalse: [ console warn: 'Warning: --base-path parameter ' , self basePath , ' is not a directory.' ]]\x0a\x09\x09ifNotNil: [ console warn: 'Warning: path at --base-path parameter ' , self basePath , ' does not exist.' ]].",
|
|
|
+messageSends: ["stat:then:", "basePath", "ifNil:ifNotNil:", "ifFalse:", "isDirectory", "warn:", ","],
|
|
|
+referencedClasses: []
|
|
|
+}),
|
|
|
+smalltalk.FileServer);
|
|
|
+
|
|
|
smalltalk.addMethod(
|
|
|
smalltalk.method({
|
|
|
selector: "withBasePath:",
|
|
@@ -39699,6 +39741,22 @@ referencedClasses: ["Array"]
|
|
|
}),
|
|
|
smalltalk.FileServer.klass);
|
|
|
|
|
|
+smalltalk.addMethod(
|
|
|
+smalltalk.method({
|
|
|
+selector: "defaultBasePath",
|
|
|
+protocol: 'accessing',
|
|
|
+fn: function (){
|
|
|
+var self=this;
|
|
|
+return smalltalk.withContext(function($ctx1) {
|
|
|
+return "./";
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"defaultBasePath",{},smalltalk.FileServer.klass)})},
|
|
|
+args: [],
|
|
|
+source: "defaultBasePath\x0a\x09^ './'",
|
|
|
+messageSends: [],
|
|
|
+referencedClasses: []
|
|
|
+}),
|
|
|
+smalltalk.FileServer.klass);
|
|
|
+
|
|
|
smalltalk.addMethod(
|
|
|
smalltalk.method({
|
|
|
selector: "defaultHost",
|