Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Base: Some cleanups by moving /res folders to /usr/share and removing some useless config files #25606

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Base/etc/shellrc
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
9 changes: 0 additions & 9 deletions Base/home/anon/.config/FileManager.ini

This file was deleted.

2 changes: 0 additions & 2 deletions Base/home/anon/.config/FontEditor.ini

This file was deleted.

12 changes: 0 additions & 12 deletions Base/home/anon/.config/PixelPaint.ini

This file was deleted.

3 changes: 0 additions & 3 deletions Base/home/anon/.config/Taskbar.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[Clock]
TimeFormat=%T

[QuickLaunch_Entries]
Browser=0:Browser.af
FileManager=1:FileManager.af
Expand Down
13 changes: 0 additions & 13 deletions Base/home/anon/.config/Terminal.ini

This file was deleted.

4 changes: 0 additions & 4 deletions Base/home/anon/.config/TextEditor.ini

This file was deleted.

File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion Base/usr/share/man/man1/fortune.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

<!-- Auto-generated through ArgsParser -->
2 changes: 1 addition & 1 deletion Meta/build-root-filesystem.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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... "
Expand Down
2 changes: 1 addition & 1 deletion Meta/lint-shell-scripts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions Meta/new-project.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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\"."
Expand Down
4 changes: 2 additions & 2 deletions Tests/Spreadsheet/test-spreadsheet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion Userland/Applications/FontEditor/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ ErrorOr<int> 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);
Expand Down
2 changes: 1 addition & 1 deletion Userland/Applications/Spreadsheet/Spreadsheet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
1 change: 1 addition & 0 deletions Userland/Applications/Spreadsheet/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ ErrorOr<int> 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);
Expand Down
2 changes: 1 addition & 1 deletion Userland/DevTools/HackStudio/ProjectTemplate.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace HackStudio {

class ProjectTemplate : public RefCounted<ProjectTemplate> {
public:
static ByteString templates_path() { return "/res/devel/templates"; }
static ByteString templates_path() { return "/usr/share/HackStudio/templates"; }

static RefPtr<ProjectTemplate> load_from_manifest(ByteString const& manifest_path);

Expand Down
4 changes: 2 additions & 2 deletions Userland/Games/MasterWord/WordGame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ void WordGame::read_words()
m_words.clear();

auto try_load_words = [&]() -> ErrorOr<void> {
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<u8, 128> buffer;

Expand All @@ -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);
}
}
Expand Down
1 change: 1 addition & 0 deletions Userland/Games/MasterWord/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ ErrorOr<int> 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));
Expand Down
4 changes: 2 additions & 2 deletions Userland/Utilities/fortune.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ ErrorOr<int> 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<bool> force_color;

Expand All @@ -98,7 +98,7 @@ ErrorOr<int> 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));
Expand Down