|
@@ -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);
|
|
@@ -38859,18 +38859,12 @@ protocol: 'accessing',
|
|
|
fn: function (aString){
|
|
|
var self=this;
|
|
|
return smalltalk.withContext(function($ctx1) {
|
|
|
-var $1;
|
|
|
-$1=self._validateBasePath_(aString);
|
|
|
-if(smalltalk.assert($1)){
|
|
|
self["@basePath"]=aString;
|
|
|
-self["@basePath"];
|
|
|
-} else {
|
|
|
-_st(console)._log_("Warning: The base path is set to ".__comma(self._basePath()));
|
|
|
-};
|
|
|
+self._validateBasePath();
|
|
|
return self}, function($ctx1) {$ctx1.fill(self,"basePath:",{aString:aString},smalltalk.FileServer)})},
|
|
|
args: ["aString"],
|
|
|
-source: "basePath: aString\x0a\x09(self validateBasePath: aString)\x0a\x09\x09ifTrue:\x09[\x09basePath := aString\x09]\x0a\x09\x09ifFalse: [ console log: 'Warning: The base path is set to ', (self basePath) ].",
|
|
|
-messageSends: ["ifTrue:ifFalse:", "validateBasePath:", "log:", ",", "basePath"],
|
|
|
+source: "basePath: aString\x0a\x09basePath := aString.\x0a\x09self validateBasePath.",
|
|
|
+messageSends: ["validateBasePath"],
|
|
|
referencedClasses: []
|
|
|
}),
|
|
|
smalltalk.FileServer);
|
|
@@ -39560,50 +39554,55 @@ smalltalk.FileServer);
|
|
|
|
|
|
smalltalk.addMethod(
|
|
|
smalltalk.method({
|
|
|
-selector: "validateBasePath:",
|
|
|
+selector: "validateBasePath",
|
|
|
protocol: 'private',
|
|
|
-fn: function (aString){
|
|
|
+fn: function (){
|
|
|
var self=this;
|
|
|
var stat;
|
|
|
function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
|
|
|
return smalltalk.withContext(function($ctx1) {
|
|
|
-var $1,$5,$4,$3,$2,$6,$7,$8;
|
|
|
+var $1,$2,$3,$8,$7,$6,$5,$4,$9,$10,$11;
|
|
|
var $early={};
|
|
|
try {
|
|
|
_st((function(){
|
|
|
return smalltalk.withContext(function($ctx2) {
|
|
|
-stat=_st(self["@fs"])._statSync_(_st(self["@path"])._join_wiith_("./",aString));
|
|
|
+$1=self["@fs"];
|
|
|
+$2=self._basePath();
|
|
|
+$ctx2.sendIdx["basePath"]=1;
|
|
|
+stat=_st($1)._statSync_($2);
|
|
|
return stat;
|
|
|
}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(err){
|
|
|
return smalltalk.withContext(function($ctx2) {
|
|
|
-$1=console;
|
|
|
-$5="Warning: option --base-path ".__comma(aString);
|
|
|
+$3=console;
|
|
|
+$8=self._basePath();
|
|
|
+$ctx2.sendIdx["basePath"]=2;
|
|
|
+$7="Warning: option --base-path ".__comma($8);
|
|
|
$ctx2.sendIdx[","]=4;
|
|
|
-$4=_st($5).__comma(", that path is ");
|
|
|
+$6=_st($7).__comma(", that path is ");
|
|
|
$ctx2.sendIdx[","]=3;
|
|
|
-$3=_st($4).__comma(_st(err)._messageText());
|
|
|
+$5=_st($6).__comma(_st(err)._messageText());
|
|
|
$ctx2.sendIdx[","]=2;
|
|
|
-$2=_st($3).__comma(".");
|
|
|
+$4=_st($5).__comma(".");
|
|
|
$ctx2.sendIdx[","]=1;
|
|
|
-_st($1)._log_($2);
|
|
|
+_st($3)._log_($4);
|
|
|
$ctx2.sendIdx["log:"]=1;
|
|
|
throw $early=[false];
|
|
|
}, function($ctx2) {$ctx2.fillBlock({err:err},$ctx1,2)})}));
|
|
|
-$6=_st(stat)._isDirectory();
|
|
|
-if(! smalltalk.assert($6)){
|
|
|
-$7=console;
|
|
|
-$8=_st("Warning: option --base-path ".__comma(aString)).__comma(" , it is not a directory.");
|
|
|
+$9=_st(stat)._isDirectory();
|
|
|
+if(! smalltalk.assert($9)){
|
|
|
+$10=console;
|
|
|
+$11=_st("Warning: option --base-path ".__comma(self._basePath())).__comma(" , it is not a directory.");
|
|
|
$ctx1.sendIdx[","]=5;
|
|
|
-_st($7)._log_($8);
|
|
|
+_st($10)._log_($11);
|
|
|
return false;
|
|
|
};
|
|
|
return true;
|
|
|
}
|
|
|
catch(e) {if(e===$early)return e[0]; throw e}
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"validateBasePath:",{aString:aString,stat:stat},smalltalk.FileServer)})},
|
|
|
-args: ["aString"],
|
|
|
-source: "validateBasePath: aString\x0a\x09\x22The basePath must be an existing directory. \x22\x0a\x09| stat |\x0a\x09[ stat := fs statSync: (path join: './' wiith: aString) ] on: Error \x0a\x09do: [ :err | console log: 'Warning: option --base-path ' , aString , ', that path is ' , (err messageText) , '.' . ^ false ].\x0a\x09stat isDirectory ifFalse: [\x09\x0a\x09\x09console log: 'Warning: option --base-path ' , aString , ' , it is not a directory.' . ^ false ].\x0a\x09^ true",
|
|
|
-messageSends: ["on:do:", "statSync:", "join:wiith:", "log:", ",", "messageText", "ifFalse:", "isDirectory"],
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"validateBasePath",{stat:stat},smalltalk.FileServer)})},
|
|
|
+args: [],
|
|
|
+source: "validateBasePath\x0a\x09\x22The basePath must be an existing directory. \x22\x0a\x09| stat |\x0a\x09[ stat := fs statSync: self basePath ] on: Error \x0a\x09do: [ :err | console log: 'Warning: option --base-path ' , (self basePath) , ', that path is ' , (err messageText) , '.' . ^ false ].\x0a\x09stat isDirectory ifFalse: [\x09\x0a\x09\x09console log: 'Warning: option --base-path ' , (self basePath) , ' , it is not a directory.' . ^ false ].\x0a\x09^ true",
|
|
|
+messageSends: ["on:do:", "statSync:", "basePath", "log:", ",", "messageText", "ifFalse:", "isDirectory"],
|
|
|
referencedClasses: ["Error"]
|
|
|
}),
|
|
|
smalltalk.FileServer);
|
|
@@ -39756,6 +39755,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",
|