summaryrefslogtreecommitdiff
path: root/Source/Applications
diff options
context:
space:
mode:
authorAlexis211 <alexis211@gmail.com>2009-12-24 23:23:22 +0100
committerAlexis211 <alexis211@gmail.com>2009-12-24 23:23:22 +0100
commitc4cb32b8534610a92931d825efefd6892e8412af (patch)
tree422755c6f7b93604823f3f4270ea6d46d0183326 /Source/Applications
parent714902e17c91200f53d0ad9a356466ee60b59d98 (diff)
downloadMelon-c4cb32b8534610a92931d825efefd6892e8412af.tar.gz
Melon-c4cb32b8534610a92931d825efefd6892e8412af.zip
More work on shell
Diffstat (limited to 'Source/Applications')
-rw-r--r--Source/Applications/Demos/GOL.cpp2
-rw-r--r--Source/Applications/Shell/Shell.class.cpp12
2 files changed, 10 insertions, 4 deletions
diff --git a/Source/Applications/Demos/GOL.cpp b/Source/Applications/Demos/GOL.cpp
index 48d728b..70655a9 100644
--- a/Source/Applications/Demos/GOL.cpp
+++ b/Source/Applications/Demos/GOL.cpp
@@ -45,7 +45,7 @@ int GOL::run() {
}
}
}
- outvt << MVT::movecsr(0, 0);
+ outvt << MVT::movecsr(0, 0) << FLUSH;
outvt.write(tmp.toString()); //BYPASS buffering
outvt<< "Press Ctrl+h for help" << FLUSH;
diff --git a/Source/Applications/Shell/Shell.class.cpp b/Source/Applications/Shell/Shell.class.cpp
index 4bc8e11..1b7f25e 100644
--- a/Source/Applications/Shell/Shell.class.cpp
+++ b/Source/Applications/Shell/Shell.class.cpp
@@ -32,6 +32,10 @@ int Shell::run() {
{"", 0}
};
+ String dn = FS::dirname(pr.argv(0));
+ FSNode shellDir = (dn.empty() ? FS::cwdNode() : FS::find(dn, FS::cwdNode()));
+ String appletsDir = FS::find("Applets", shellDir).path() + "/";
+
setupVars();
cwd = FS::cwdNode();
@@ -84,8 +88,10 @@ int Shell::run() {
} else if (cmd[0] == "help") {
Vector<String> args;
args.push("cat");
- args.push("/Applications/Shell/Help.txt");
- appRun("cat", args);
+ args.push(shellDir.path());
+ if (args.back() != "/") args.back() += "/";
+ args.back() += "Help.txt";
+ if (!appRun(appletsDir + "cat", args)) outvt << "Could not find cat command to display help file\n";
} else if (cmd[0] == "echo") {
for (u32int i = 1; i < cmd.size(); i++) {
if (i > 1) outvt << " ";
@@ -108,7 +114,7 @@ int Shell::run() {
i++;
}
if (!found) {
- if (!appRun(cmd[0], cmd))
+ if (!appRun(appletsDir + cmd[0], cmd))
outvt << "Unknown command : " << cmd[0] << "\n";
}
}