From e486c1411539cfdd9b43e49397dcea7f34eab85a Mon Sep 17 00:00:00 2001 From: Bastiaan van der Plaat Date: Mon, 30 Dec 2024 20:16:43 +0100 Subject: [PATCH 1/6] Spreadsheet: Move runtime.js file from /res to /usr/share --- Base/{res/js => usr/share}/Spreadsheet/runtime.js | 0 Tests/Spreadsheet/test-spreadsheet.cpp | 4 ++-- Userland/Applications/Spreadsheet/Spreadsheet.cpp | 2 +- Userland/Applications/Spreadsheet/main.cpp | 1 + 4 files changed, 4 insertions(+), 3 deletions(-) rename Base/{res/js => usr/share}/Spreadsheet/runtime.js (100%) diff --git a/Base/res/js/Spreadsheet/runtime.js b/Base/usr/share/Spreadsheet/runtime.js similarity index 100% rename from Base/res/js/Spreadsheet/runtime.js rename to Base/usr/share/Spreadsheet/runtime.js diff --git a/Tests/Spreadsheet/test-spreadsheet.cpp b/Tests/Spreadsheet/test-spreadsheet.cpp index 3b366beeddfb9b..07f5d527efceed 100644 --- a/Tests/Spreadsheet/test-spreadsheet.cpp +++ b/Tests/Spreadsheet/test-spreadsheet.cpp @@ -10,9 +10,9 @@ TEST_ROOT("Userland/Applications/Spreadsheet/Tests"); #ifdef AK_OS_SERENITY -static constexpr auto s_spreadsheet_runtime_path = "/res/js/Spreadsheet/runtime.js"sv; +static constexpr auto s_spreadsheet_runtime_path = "/usr/share/Spreadsheet/runtime.js"sv; #else -static constexpr auto s_spreadsheet_runtime_path = "../../../../Base/res/js/Spreadsheet/runtime.js"sv; +static constexpr auto s_spreadsheet_runtime_path = "../../../../Base/usr/share/Spreadsheet/runtime.js"sv; #endif TESTJS_RUN_FILE_FUNCTION(ByteString const&, JS::Realm& realm, JS::ExecutionContext& global_execution_context) diff --git a/Userland/Applications/Spreadsheet/Spreadsheet.cpp b/Userland/Applications/Spreadsheet/Spreadsheet.cpp index d4a311cd445734..5b95a5c48c8a2f 100644 --- a/Userland/Applications/Spreadsheet/Spreadsheet.cpp +++ b/Userland/Applications/Spreadsheet/Spreadsheet.cpp @@ -52,7 +52,7 @@ Sheet::Sheet(Workbook& workbook) global_object().define_direct_property("thisSheet", &global_object(), JS::default_attributes); // Self-reference is unfortunate, but required. // Sadly, these have to be evaluated once per sheet. - constexpr auto runtime_file_path = "/res/js/Spreadsheet/runtime.js"sv; + constexpr auto runtime_file_path = "/usr/share/Spreadsheet/runtime.js"sv; auto file_or_error = Core::File::open(runtime_file_path, Core::File::OpenMode::Read); if (!file_or_error.is_error()) { auto buffer = file_or_error.value()->read_until_eof().release_value_but_fixme_should_propagate_errors(); diff --git a/Userland/Applications/Spreadsheet/main.cpp b/Userland/Applications/Spreadsheet/main.cpp index 9f69f9426f23b9..650defa9603dfe 100644 --- a/Userland/Applications/Spreadsheet/main.cpp +++ b/Userland/Applications/Spreadsheet/main.cpp @@ -48,6 +48,7 @@ ErrorOr serenity_main(Main::Arguments arguments) TRY(Core::System::unveil("/tmp/session/%sid/portal/webcontent", "rw")); TRY(Core::System::unveil("/etc", "r")); TRY(Core::System::unveil("/res", "r")); + TRY(Core::System::unveil("/usr/share/Spreadsheet", "r")); TRY(Core::System::unveil(nullptr, nullptr)); auto app_icon = GUI::Icon::default_icon("app-spreadsheet"sv); From 20f968debede44cfd389f71b1380a0cbe4e881bd Mon Sep 17 00:00:00 2001 From: Bastiaan van der Plaat Date: Mon, 30 Dec 2024 20:17:04 +0100 Subject: [PATCH 2/6] MasterWord: Move words.txt file to /usr/share --- Base/{res => usr/share/MasterWord}/words.txt | 0 Userland/Games/MasterWord/WordGame.cpp | 4 ++-- Userland/Games/MasterWord/main.cpp | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) rename Base/{res => usr/share/MasterWord}/words.txt (100%) diff --git a/Base/res/words.txt b/Base/usr/share/MasterWord/words.txt similarity index 100% rename from Base/res/words.txt rename to Base/usr/share/MasterWord/words.txt diff --git a/Userland/Games/MasterWord/WordGame.cpp b/Userland/Games/MasterWord/WordGame.cpp index d18a2149e54b76..5abe5908073bee 100644 --- a/Userland/Games/MasterWord/WordGame.cpp +++ b/Userland/Games/MasterWord/WordGame.cpp @@ -175,7 +175,7 @@ void WordGame::read_words() m_words.clear(); auto try_load_words = [&]() -> ErrorOr { - auto response = TRY(Core::File::open("/res/words.txt"sv, Core::File::OpenMode::Read)); + auto response = TRY(Core::File::open("/usr/share/MasterWord/words.txt"sv, Core::File::OpenMode::Read)); auto words_file = TRY(Core::InputBufferedFile::create(move(response))); Array buffer; @@ -189,7 +189,7 @@ void WordGame::read_words() }; if (try_load_words().is_error()) { - GUI::MessageBox::show(nullptr, "Could not read /res/words.txt.\nPlease ensure this file exists and restart MasterWord."sv, "MasterWord"sv); + GUI::MessageBox::show(nullptr, "Could not read /usr/share/MasterWord/words.txt.\nPlease ensure this file exists and restart MasterWord."sv, "MasterWord"sv); exit(0); } } diff --git a/Userland/Games/MasterWord/main.cpp b/Userland/Games/MasterWord/main.cpp index a00c43a3375679..467c5f31aff7c7 100644 --- a/Userland/Games/MasterWord/main.cpp +++ b/Userland/Games/MasterWord/main.cpp @@ -36,6 +36,7 @@ ErrorOr serenity_main(Main::Arguments arguments) TRY(Core::System::unveil("/tmp/session/%sid/portal/launch", "rw")); TRY(Core::System::unveil("/res", "r")); + TRY(Core::System::unveil("/usr/share/MasterWord", "r")); TRY(Core::System::unveil(nullptr, nullptr)); auto app_icon = TRY(GUI::Icon::try_create_default_icon("app-masterword"sv)); From ad158914b47ffb8469be13f0ab75a9d0a6dfd648 Mon Sep 17 00:00:00 2001 From: Bastiaan van der Plaat Date: Mon, 30 Dec 2024 20:17:34 +0100 Subject: [PATCH 3/6] Utilities/fortune: Move fortunes.json to /usr/share --- Base/{res => usr/share/fortune}/fortunes.json | 0 Base/usr/share/man/man1/fortune.md | 2 +- Userland/Utilities/fortune.cpp | 4 ++-- 3 files changed, 3 insertions(+), 3 deletions(-) rename Base/{res => usr/share/fortune}/fortunes.json (100%) diff --git a/Base/res/fortunes.json b/Base/usr/share/fortune/fortunes.json similarity index 100% rename from Base/res/fortunes.json rename to Base/usr/share/fortune/fortunes.json diff --git a/Base/usr/share/man/man1/fortune.md b/Base/usr/share/man/man1/fortune.md index 661b2f0345dcbd..ea69a75ec3423d 100644 --- a/Base/usr/share/man/man1/fortune.md +++ b/Base/usr/share/man/man1/fortune.md @@ -18,6 +18,6 @@ Open a fortune cookie, receive a free quote for the day! ## Arguments -- `path`: Path to JSON file with quotes (/res/fortunes.json by default) +- `path`: Path to JSON file with quotes (/usr/share/fortune/fortunes.json by default) diff --git a/Userland/Utilities/fortune.cpp b/Userland/Utilities/fortune.cpp index 9f3614e9c75db8..53d63dbdc4d9bc 100644 --- a/Userland/Utilities/fortune.cpp +++ b/Userland/Utilities/fortune.cpp @@ -74,7 +74,7 @@ ErrorOr serenity_main(Main::Arguments arguments) { TRY(Core::System::pledge("stdio rpath")); - StringView path = "/res/fortunes.json"sv; + StringView path = "/usr/share/fortune/fortunes.json"sv; Optional force_color; @@ -98,7 +98,7 @@ ErrorOr serenity_main(Main::Arguments arguments) return true; }, }); - args_parser.add_positional_argument(path, "Path to JSON file with quotes (/res/fortunes.json by default)", "path", Core::ArgsParser::Required::No); + args_parser.add_positional_argument(path, "Path to JSON file with quotes (/usr/share/fortune/fortunes.json by default)", "path", Core::ArgsParser::Required::No); args_parser.parse(arguments); auto file = TRY(Core::File::open(path, Core::File::OpenMode::Read)); From d754ac137487fb1b716674c1a9456189e92191dc Mon Sep 17 00:00:00 2001 From: Bastiaan van der Plaat Date: Mon, 30 Dec 2024 20:19:29 +0100 Subject: [PATCH 4/6] Base: Rename /usr/share/shell to /usr/share/Shell --- Base/etc/shellrc | 2 +- Base/usr/share/{shell => Shell}/completion/builtin.sh | 0 Base/usr/share/{shell => Shell}/completion/proxy.sh | 0 Meta/lint-shell-scripts.sh | 2 +- 4 files changed, 2 insertions(+), 2 deletions(-) rename Base/usr/share/{shell => Shell}/completion/builtin.sh (100%) rename Base/usr/share/{shell => Shell}/completion/proxy.sh (100%) diff --git a/Base/etc/shellrc b/Base/etc/shellrc index 3a0936f6b5fdcc..1ee923b2acc057 100644 --- a/Base/etc/shellrc +++ b/Base/etc/shellrc @@ -40,4 +40,4 @@ export TMPDIR=/tmp PROGRAMS_ALLOWED_TO_MODIFY_DEFAULT_TERMIOS=(stty) -for /usr/share/shell/completion/*.sh { source $it } +for /usr/share/Shell/completion/*.sh { source $it } diff --git a/Base/usr/share/shell/completion/builtin.sh b/Base/usr/share/Shell/completion/builtin.sh similarity index 100% rename from Base/usr/share/shell/completion/builtin.sh rename to Base/usr/share/Shell/completion/builtin.sh diff --git a/Base/usr/share/shell/completion/proxy.sh b/Base/usr/share/Shell/completion/proxy.sh similarity index 100% rename from Base/usr/share/shell/completion/proxy.sh rename to Base/usr/share/Shell/completion/proxy.sh diff --git a/Meta/lint-shell-scripts.sh b/Meta/lint-shell-scripts.sh index e7d978090966e5..af8c8f41bd642d 100755 --- a/Meta/lint-shell-scripts.sh +++ b/Meta/lint-shell-scripts.sh @@ -13,7 +13,7 @@ if [ "$#" -eq "0" ]; then ':!:Tests/LibShell' \ ':!:Base/home/anon/Tests' \ ':!:Base/root/generate_manpages.sh' \ - ':!:Base/usr/share/shell' \ + ':!:Base/usr/share/Shell' \ ':!:Base/etc/shellrc' \ ) else From e3793c395377e1a3be74a577317e32924670e740 Mon Sep 17 00:00:00 2001 From: Bastiaan van der Plaat Date: Mon, 30 Dec 2024 20:20:39 +0100 Subject: [PATCH 5/6] HackStudio: Move /res/devel to /usr/share/HackStudio --- .../share/HackStudio}/templates/cpp-basic.ini | 0 .../share/HackStudio}/templates/cpp-basic.postcreate | 0 .../share/HackStudio}/templates/cpp-basic/main.cpp | 0 .../share/HackStudio}/templates/cpp-library.ini | 0 .../share/HackStudio}/templates/cpp-library.postcreate | 0 .../share/HackStudio}/templates/cpp-library/Class1.cpp | 0 .../share/HackStudio}/templates/cpp-library/Class1.h | 0 .../devel => usr/share/HackStudio}/templates/empty.ini | 0 .../share/HackStudio}/templates/serenity-application.ini | 0 .../HackStudio}/templates/serenity-application.postcreate | 0 .../HackStudio}/templates/serenity-application/main.cpp | 0 Meta/build-root-filesystem.sh | 2 +- Meta/new-project.sh | 8 ++++---- Userland/DevTools/HackStudio/ProjectTemplate.h | 2 +- 14 files changed, 6 insertions(+), 6 deletions(-) rename Base/{res/devel => usr/share/HackStudio}/templates/cpp-basic.ini (100%) rename Base/{res/devel => usr/share/HackStudio}/templates/cpp-basic.postcreate (100%) rename Base/{res/devel => usr/share/HackStudio}/templates/cpp-basic/main.cpp (100%) rename Base/{res/devel => usr/share/HackStudio}/templates/cpp-library.ini (100%) rename Base/{res/devel => usr/share/HackStudio}/templates/cpp-library.postcreate (100%) rename Base/{res/devel => usr/share/HackStudio}/templates/cpp-library/Class1.cpp (100%) rename Base/{res/devel => usr/share/HackStudio}/templates/cpp-library/Class1.h (100%) rename Base/{res/devel => usr/share/HackStudio}/templates/empty.ini (100%) rename Base/{res/devel => usr/share/HackStudio}/templates/serenity-application.ini (100%) rename Base/{res/devel => usr/share/HackStudio}/templates/serenity-application.postcreate (100%) rename Base/{res/devel => usr/share/HackStudio}/templates/serenity-application/main.cpp (100%) diff --git a/Base/res/devel/templates/cpp-basic.ini b/Base/usr/share/HackStudio/templates/cpp-basic.ini similarity index 100% rename from Base/res/devel/templates/cpp-basic.ini rename to Base/usr/share/HackStudio/templates/cpp-basic.ini diff --git a/Base/res/devel/templates/cpp-basic.postcreate b/Base/usr/share/HackStudio/templates/cpp-basic.postcreate similarity index 100% rename from Base/res/devel/templates/cpp-basic.postcreate rename to Base/usr/share/HackStudio/templates/cpp-basic.postcreate diff --git a/Base/res/devel/templates/cpp-basic/main.cpp b/Base/usr/share/HackStudio/templates/cpp-basic/main.cpp similarity index 100% rename from Base/res/devel/templates/cpp-basic/main.cpp rename to Base/usr/share/HackStudio/templates/cpp-basic/main.cpp diff --git a/Base/res/devel/templates/cpp-library.ini b/Base/usr/share/HackStudio/templates/cpp-library.ini similarity index 100% rename from Base/res/devel/templates/cpp-library.ini rename to Base/usr/share/HackStudio/templates/cpp-library.ini diff --git a/Base/res/devel/templates/cpp-library.postcreate b/Base/usr/share/HackStudio/templates/cpp-library.postcreate similarity index 100% rename from Base/res/devel/templates/cpp-library.postcreate rename to Base/usr/share/HackStudio/templates/cpp-library.postcreate diff --git a/Base/res/devel/templates/cpp-library/Class1.cpp b/Base/usr/share/HackStudio/templates/cpp-library/Class1.cpp similarity index 100% rename from Base/res/devel/templates/cpp-library/Class1.cpp rename to Base/usr/share/HackStudio/templates/cpp-library/Class1.cpp diff --git a/Base/res/devel/templates/cpp-library/Class1.h b/Base/usr/share/HackStudio/templates/cpp-library/Class1.h similarity index 100% rename from Base/res/devel/templates/cpp-library/Class1.h rename to Base/usr/share/HackStudio/templates/cpp-library/Class1.h diff --git a/Base/res/devel/templates/empty.ini b/Base/usr/share/HackStudio/templates/empty.ini similarity index 100% rename from Base/res/devel/templates/empty.ini rename to Base/usr/share/HackStudio/templates/empty.ini diff --git a/Base/res/devel/templates/serenity-application.ini b/Base/usr/share/HackStudio/templates/serenity-application.ini similarity index 100% rename from Base/res/devel/templates/serenity-application.ini rename to Base/usr/share/HackStudio/templates/serenity-application.ini diff --git a/Base/res/devel/templates/serenity-application.postcreate b/Base/usr/share/HackStudio/templates/serenity-application.postcreate similarity index 100% rename from Base/res/devel/templates/serenity-application.postcreate rename to Base/usr/share/HackStudio/templates/serenity-application.postcreate diff --git a/Base/res/devel/templates/serenity-application/main.cpp b/Base/usr/share/HackStudio/templates/serenity-application/main.cpp similarity index 100% rename from Base/res/devel/templates/serenity-application/main.cpp rename to Base/usr/share/HackStudio/templates/serenity-application/main.cpp diff --git a/Meta/build-root-filesystem.sh b/Meta/build-root-filesystem.sh index 8b69fd0d8f1f8b..b400e2252e0629 100755 --- a/Meta/build-root-filesystem.sh +++ b/Meta/build-root-filesystem.sh @@ -135,7 +135,7 @@ if [ -f mnt/bin/network-settings ]; then fi chmod 600 mnt/etc/shadow -chmod 755 mnt/res/devel/templates/*.postcreate +chmod 755 mnt/usr/share/HackStudio/templates/*.postcreate echo "done" printf "creating initial filesystem structure... " diff --git a/Meta/new-project.sh b/Meta/new-project.sh index be60745732c77c..40c510559cd132 100755 --- a/Meta/new-project.sh +++ b/Meta/new-project.sh @@ -9,7 +9,7 @@ script_name="$(basename "$0")" function list_templates() { echo "Available templates:" - for file in ./Base/res/devel/templates/*.ini; do + for file in ./Base/usr/share/HackStudio/templates/*.ini; do printf ' %s - ' "$(basename "${file%%.ini}")" awk -F "=" '/Description/ { print $2 }' "$file" done @@ -48,9 +48,9 @@ done TEMPLATE="$1" DESTINATION="$2" -TEMPLATE_SOURCE_DIRECTORY="./Base/res/devel/templates/$TEMPLATE" -TEMPLATE_INI="./Base/res/devel/templates/$TEMPLATE.ini" -TEMPLATE_POSTCREATE="./Base/res/devel/templates/$TEMPLATE.postcreate" +TEMPLATE_SOURCE_DIRECTORY="./Base/usr/share/HackStudio/templates/$TEMPLATE" +TEMPLATE_INI="./Base/usr/share/HackStudio/templates/$TEMPLATE.ini" +TEMPLATE_POSTCREATE="./Base/usr/share/HackStudio/templates/$TEMPLATE.postcreate" if [[ ! -f "$TEMPLATE_INI" ]]; then echo "$script_name: unknown template \"$TEMPLATE\"." diff --git a/Userland/DevTools/HackStudio/ProjectTemplate.h b/Userland/DevTools/HackStudio/ProjectTemplate.h index 9e5f0750ac0b32..5c7738cfc26821 100644 --- a/Userland/DevTools/HackStudio/ProjectTemplate.h +++ b/Userland/DevTools/HackStudio/ProjectTemplate.h @@ -17,7 +17,7 @@ namespace HackStudio { class ProjectTemplate : public RefCounted { public: - static ByteString templates_path() { return "/res/devel/templates"; } + static ByteString templates_path() { return "/usr/share/HackStudio/templates"; } static RefPtr load_from_manifest(ByteString const& manifest_path); From e35bdd3460b941cb1239e8d386b266070b43ff98 Mon Sep 17 00:00:00 2001 From: Bastiaan van der Plaat Date: Mon, 30 Dec 2024 20:35:28 +0100 Subject: [PATCH 6/6] Base: Remove useless default config files from /home/anon/.config --- Base/home/anon/.config/FileManager.ini | 9 --------- Base/home/anon/.config/FontEditor.ini | 2 -- Base/home/anon/.config/PixelPaint.ini | 12 ------------ Base/home/anon/.config/Taskbar.ini | 3 --- Base/home/anon/.config/Terminal.ini | 13 ------------- Base/home/anon/.config/TextEditor.ini | 4 ---- Userland/Applications/FontEditor/main.cpp | 2 +- 7 files changed, 1 insertion(+), 44 deletions(-) delete mode 100644 Base/home/anon/.config/FileManager.ini delete mode 100644 Base/home/anon/.config/FontEditor.ini delete mode 100644 Base/home/anon/.config/PixelPaint.ini delete mode 100644 Base/home/anon/.config/Terminal.ini delete mode 100644 Base/home/anon/.config/TextEditor.ini diff --git a/Base/home/anon/.config/FileManager.ini b/Base/home/anon/.config/FileManager.ini deleted file mode 100644 index 1dc569206d69fb..00000000000000 --- a/Base/home/anon/.config/FileManager.ini +++ /dev/null @@ -1,9 +0,0 @@ -[DirectoryView] -ViewMode=Icon -ShowDotFiles=false - -[Layout] -ShowToolbar=true -ShowStatusBar=true -ShowLocationBar=true -ShowFolderPane=true diff --git a/Base/home/anon/.config/FontEditor.ini b/Base/home/anon/.config/FontEditor.ini deleted file mode 100644 index 52de60e007a0da..00000000000000 --- a/Base/home/anon/.config/FontEditor.ini +++ /dev/null @@ -1,2 +0,0 @@ -[Defaults] -Font=/res/fonts/KaticaRegular10.font diff --git a/Base/home/anon/.config/PixelPaint.ini b/Base/home/anon/.config/PixelPaint.ini deleted file mode 100644 index 6c1f32a2e6f8b5..00000000000000 --- a/Base/home/anon/.config/PixelPaint.ini +++ /dev/null @@ -1,12 +0,0 @@ -[PixelGrid] -Threshold=15 -Show=true - -[Rulers] -Show=true - -[Guides] -Show=true - -[ImageEditor] -ShowActiveLayerBoundary=true diff --git a/Base/home/anon/.config/Taskbar.ini b/Base/home/anon/.config/Taskbar.ini index 1f7e43a5508bbc..cad6e00f84151a 100644 --- a/Base/home/anon/.config/Taskbar.ini +++ b/Base/home/anon/.config/Taskbar.ini @@ -1,6 +1,3 @@ -[Clock] -TimeFormat=%T - [QuickLaunch_Entries] Browser=0:Browser.af FileManager=1:FileManager.af diff --git a/Base/home/anon/.config/Terminal.ini b/Base/home/anon/.config/Terminal.ini deleted file mode 100644 index 6f0d38b6f70dc3..00000000000000 --- a/Base/home/anon/.config/Terminal.ini +++ /dev/null @@ -1,13 +0,0 @@ -[Startup] -Command= -[Terminal] -ShowScrollBar=true -MaxHistorySize=1024 -AutoMark=MarkInteractiveShellPrompt -[Window] -Opacity=255 -Bell=Visible -ColorScheme=Default -[Cursor] -Shape=Block -Blinking=true diff --git a/Base/home/anon/.config/TextEditor.ini b/Base/home/anon/.config/TextEditor.ini deleted file mode 100644 index 376c3657f63a0e..00000000000000 --- a/Base/home/anon/.config/TextEditor.ini +++ /dev/null @@ -1,4 +0,0 @@ -[Layout] -ShowRuler=true -ShowToolbar=true -ShowStatusBar=true diff --git a/Userland/Applications/FontEditor/main.cpp b/Userland/Applications/FontEditor/main.cpp index bdeb396c4ac3f8..b3894e37847e03 100644 --- a/Userland/Applications/FontEditor/main.cpp +++ b/Userland/Applications/FontEditor/main.cpp @@ -59,7 +59,7 @@ ErrorOr serenity_main(Main::Arguments arguments) window->show(); - auto default_path = TRY(String::from_byte_string(Config::read_string("FontEditor"sv, "Defaults"sv, "Font"sv, {}))); + auto default_path = TRY(String::from_byte_string(Config::read_string("FontEditor"sv, "Defaults"sv, "Font"sv, "/res/fonts/KaticaRegular10.font"sv))); auto path_to_load = path.is_empty() ? default_path : path; if (!path_to_load.is_empty()) { auto response = FileSystemAccessClient::Client::the().request_file_read_only_approved(window, path_to_load);