Browse Source

TextEditor: Open an empty document by default.

Andreas Kling 6 năm trước cách đây
mục cha
commit
a738b5cb69

+ 3 - 2
Applications/TextEditor/main.cpp

@@ -29,8 +29,9 @@ int main(int argc, char** argv)
         statusbar->set_text(String::format("Line: %d, Column: %d", editor.cursor().line(), editor.cursor().column()));
         statusbar->set_text(String::format("Line: %d, Column: %d", editor.cursor().line(), editor.cursor().column()));
     };
     };
 
 
-    String path = argc < 2 ? "/home/anon/ReadMe.md" : argv[1];
-    {
+    String path = "/tmp/TextEditor.save.txt";
+    if (argc >= 2) {
+        path = argv[1];
         StringBuilder builder;
         StringBuilder builder;
         int fd = open(path.characters(), O_RDONLY);
         int fd = open(path.characters(), O_RDONLY);
         if (fd < 0) {
         if (fd < 0) {

+ 4 - 1
Kernel/init.cpp

@@ -104,7 +104,10 @@ VFS* vfs;
     Process::create_user_process("/bin/ProcessManager", (uid_t)100, (gid_t)100, (pid_t)0, error, { }, { }, tty0);
     Process::create_user_process("/bin/ProcessManager", (uid_t)100, (gid_t)100, (pid_t)0, error, { }, { }, tty0);
 #endif
 #endif
 #ifdef SPAWN_TEXT_EDITOR
 #ifdef SPAWN_TEXT_EDITOR
-    Process::create_user_process("/bin/TextEditor", (uid_t)100, (gid_t)100, (pid_t)0, error, { }, { }, tty0);
+    Vector<String> text_editor_arguments;
+    text_editor_arguments.append("/bin/TextEditor");
+    text_editor_arguments.append("/home/anon/ReadMe.md");
+    Process::create_user_process("/bin/TextEditor", (uid_t)100, (gid_t)100, (pid_t)0, error, move(text_editor_arguments), { }, tty0);
 #endif
 #endif
 #ifdef SPAWN_FONTEDITOR
 #ifdef SPAWN_FONTEDITOR
     Process::create_user_process("/bin/FontEditor", (uid_t)100, (gid_t)100, (pid_t)0, error, { }, move(environment), tty0);
     Process::create_user_process("/bin/FontEditor", (uid_t)100, (gid_t)100, (pid_t)0, error, { }, move(environment), tty0);