Files
rainmelt/html/Session.js
2012-07-30 16:36:21 +09:00

25 lines
629 B
JavaScript

var Session = function(terminal) {
this.terminal = terminal;
this.homeDirectory = '/';
this.currentDirectory = this.homeDirectory;
};
Session.prototype.changeDirectory = function(path) {
if (path.charAt(0) == '/') {
this.currentDirectory = this.terminal.fs.toCanonicalPath(path);
} else {
this.currentDirectory = this.terminal.fs.toCanonicalPath(this.currentDirectory + '/' + path);
}
};
Session.prototype.toAbsolutePath = function(path) {
if (path.charAt(0) == '/') {
return this.terminal.fs.toCanonicalPath(path);
} else {
return this.terminal.fs.toCanonicalPath(this.currentDirectory + '/' + path);
}
};