diff --git a/apps/installer.cpp b/apps/installer.cpp index ca161a3..d476f5e 100644 --- a/apps/installer.cpp +++ b/apps/installer.cpp @@ -655,7 +655,7 @@ EsError InstallGPT(EsBlockDeviceInformation driveInformation, EsMessageDevice dr // Load the kernel. size_t kernelBytes; - void *kernel = EsFileReadAll(EsLiteral(K_OS_FOLDER "/Kernel.esx"), &kernelBytes); + void *kernel = EsFileReadAll(EsLiteral(K_SYSTEM_FOLDER "/Kernel.esx"), &kernelBytes); if (!kernel) return ES_ERROR_FILE_DOES_NOT_EXIST; m.user.context1.u = 3; @@ -832,7 +832,7 @@ EsError Install() { void *kernel; if (useMBR) { - kernel = EsFileReadAll(EsLiteral(K_OS_FOLDER "/Kernel.esx"), &kernelBytes); + kernel = EsFileReadAll(EsLiteral(K_SYSTEM_FOLDER "/Kernel.esx"), &kernelBytes); if (!kernel) return ES_ERROR_FILE_DOES_NOT_EXIST; m.user.context1.u = 6; EsMessagePost(nullptr, &m); @@ -888,7 +888,7 @@ void InstallThread(EsGeneric) { void WriteNewConfiguration() { size_t newSystemConfigurationPathBytes, newSystemConfigurationBytes; - char *newSystemConfigurationPath = EsStringAllocateAndFormat(&newSystemConfigurationPathBytes, "%s/Essence/Default.ini", + char *newSystemConfigurationPath = EsStringAllocateAndFormat(&newSystemConfigurationPathBytes, "%s/" K_SYSTEM_FOLDER_NAME "/Default.ini", newFileSystemMountPoint.prefixBytes, newFileSystemMountPoint.prefix); char *newSystemConfiguration = (char *) EsFileReadAll(newSystemConfigurationPath, newSystemConfigurationPathBytes, &newSystemConfigurationBytes); diff --git a/desktop/prefix.h b/desktop/prefix.h index 5aed781..6adcf9f 100644 --- a/desktop/prefix.h +++ b/desktop/prefix.h @@ -285,9 +285,10 @@ struct MemoryAvailable { #define K_BOOT_DRIVE "0:" #endif -#define K_OS_FOLDER K_BOOT_DRIVE "/Essence" -#define K_DESKTOP_EXECUTABLE K_OS_FOLDER "/Desktop.esx" -#define K_SYSTEM_CONFIGURATION K_OS_FOLDER "/Default.ini" +#define K_SYSTEM_FOLDER_NAME "Essence" +#define K_SYSTEM_FOLDER K_BOOT_DRIVE "/" K_SYSTEM_FOLDER_NAME +#define K_DESKTOP_EXECUTABLE K_SYSTEM_FOLDER "/Desktop.esx" +#define K_SYSTEM_CONFIGURATION K_SYSTEM_FOLDER "/Default.ini" #define WINDOW_SET_BITS_NORMAL (0) #define WINDOW_SET_BITS_SCROLL_HORIZONTAL (1) diff --git a/kernel/drivers.cpp b/kernel/drivers.cpp index 1c58080..b641891 100644 --- a/kernel/drivers.cpp +++ b/kernel/drivers.cpp @@ -196,7 +196,7 @@ const KDriver *DriverLoad(KInstalledDriver *installedDriver) { if (!module) return nullptr; module->path = buffer; - module->pathBytes = EsStringFormat(buffer, K_MAX_PATH, K_OS_FOLDER "/Modules/%s.ekm", + module->pathBytes = EsStringFormat(buffer, K_MAX_PATH, K_SYSTEM_FOLDER "/Modules/%s.ekm", installedDriver->nameBytes, installedDriver->name); module->resolveSymbol = ResolveKernelSymbol; diff --git a/res/System Configuration Template.ini b/res/System Configuration Template.ini index d7223fd..42a3c06 100644 --- a/res/System Configuration Template.ini +++ b/res/System Configuration Template.ini @@ -8,12 +8,6 @@ use_smart_quotes=1 enable_hover_state=1 enable_animations=1 -[paths] -fonts=0:/Essence/Fonts -temporary=0:/Essence/Temporary -default_settings=0:/Essence/Settings -default_user_documents=0:/ - [ui] font_fallback=Inter font_sans=Inter diff --git a/util/build.c b/util/build.c index ddf071b..169f6ec 100644 --- a/util/build.c +++ b/util/build.c @@ -657,7 +657,7 @@ void BuildCrossCompiler() { { CallSystem("echo Preparing C standard library headers... >> bin/build_cross.log"); - CallSystem("mkdir -p root/Essence root/Applications/POSIX/include root/Applications/POSIX/lib root/Applications/POSIX/bin"); + CallSystem("mkdir -p root/" SYSTEM_FOLDER_NAME " root/Applications/POSIX/include root/Applications/POSIX/lib root/Applications/POSIX/bin"); CallSystem("ports/musl/build.sh >> bin/build_cross.log 2>&1"); } diff --git a/util/build_common.h b/util/build_common.h index bceb34f..7856ef6 100644 --- a/util/build_common.h +++ b/util/build_common.h @@ -1,6 +1,9 @@ #define BINUTILS_VERSION "2.36.1" #define GCC_VERSION "11.1.0" +// Duplicated in prefix.h. +#define SYSTEM_FOLDER_NAME "Essence" + #ifndef OS_ESSENCE #include diff --git a/util/build_core.c b/util/build_core.c index ae431b7..4c32176 100644 --- a/util/build_core.c +++ b/util/build_core.c @@ -580,7 +580,7 @@ void BuildDesktop(Application *application) { ADD_BUNDLE_INPUT("res/Themes/elementary Icons License.txt", "Icons License.txt", 16); ADD_BUNDLE_INPUT("bin/Desktop.no_symbols", "$Executables/x86_64", 0x1000); - MakeBundle("root/Essence/Desktop.esx", application->bundleInputFiles, arrlenu(application->bundleInputFiles), 0); + MakeBundle("root/" SYSTEM_FOLDER_NAME "/Desktop.esx", application->bundleInputFiles, arrlenu(application->bundleInputFiles), 0); } void BuildApplication(Application *application) { @@ -776,7 +776,7 @@ void OutputSystemConfiguration() { EsINIState s = {}; char *config = (char *) LoadFile("res/System Configuration Template.ini", &s.bytes); s.buffer = config; - File file = FileOpen("root/Essence/Default.ini", 'w'); + File file = FileOpen("root/" SYSTEM_FOLDER_NAME "/Default.ini", 'w'); while (EsINIParse(&s)) { EsINIZeroTerminate(&s); @@ -793,6 +793,12 @@ void OutputSystemConfiguration() { } } + FilePrintFormat(file, "\n[paths]\n"); + FilePrintFormat(file, "fonts=0:/" SYSTEM_FOLDER_NAME "/Fonts\n"); + FilePrintFormat(file, "temporary=0:/" SYSTEM_FOLDER_NAME "/Temporary\n"); + FilePrintFormat(file, "default_settings=0:/" SYSTEM_FOLDER_NAME "/Settings\n"); + FilePrintFormat(file, "default_user_documents=0:/\n"); + for (uintptr_t i = 0; i < arrlenu(applications); i++) { if (!applications[i].install) { continue; @@ -833,7 +839,7 @@ void OutputSystemConfiguration() { FilePrintFormat(file, "\n[@application %d]\n", applications[i].id); FilePrintFormat(file, "name=%s\n", applications[i].name); FilePrintFormat(file, "executable=0:/Applications/%s.esx\n", applications[i].name); - FilePrintFormat(file, "settings_path=0:/Essence/Settings/%s\n", applications[i].name); + FilePrintFormat(file, "settings_path=0:/" SYSTEM_FOLDER_NAME "/Settings/%s\n", applications[i].name); for (uintptr_t j = 0; j < arrlenu(applications[i].properties); j++) { FilePrintFormat(file, "%s=%s\n", applications[i].properties[j].key, applications[i].properties[j].value); @@ -892,8 +898,8 @@ void BuildModule(Application *application) { if (!application->builtin) { char target[4096]; - snprintf(target, sizeof(target), "root/Essence/Modules/%s.ekm", application->name); - MakeDirectory("root/Essence/Modules"); + snprintf(target, sizeof(target), "root/" SYSTEM_FOLDER_NAME "/Modules/%s.ekm", application->name); + MakeDirectory("root/" SYSTEM_FOLDER_NAME "/Modules"); MoveFile(output, target); } } @@ -1047,7 +1053,7 @@ void LinkKernel() { Execute(toolchainCXX, "-T", "util/linker/kernel64.ld", "-o", "bin/Kernel", "bin/kernel_symbols.o", "bin/kernel_all.o", "-mno-red-zone", ArgString(kernelLinkFlags)); Execute(toolchainStrip, "-o", "bin/Kernel.esx", "--strip-all", "bin/Kernel"); - CopyFile("bin/Kernel.esx", "root/Essence/Kernel.esx", false); + CopyFile("bin/Kernel.esx", "root/" SYSTEM_FOLDER_NAME "/Kernel.esx", false); } void BuildKernel(Application *application) { @@ -1181,7 +1187,7 @@ void Install(const char *driveFile, uint64_t partitionSize, const char *partitio // TODO Update this. #if 0 if (convertFonts) { - ImportNode *fontsFolder = ImportNodeMakeDirectory(ImportNodeFindChild(&root, "Essence"), "Fonts"); + ImportNode *fontsFolder = ImportNodeMakeDirectory(ImportNodeFindChild(&root, SYSTEM_FOLDER_NAME), "Fonts"); for (uintptr_t i = 0; i < arrlenu(fontLines); i++) { if (fontLines[i].key[0] == '.') { @@ -1434,7 +1440,7 @@ int main(int argc, char **argv) { MakeDirectory("root/Applications/POSIX/lib"); MakeDirectory("root/Applications/POSIX/tmp"); MakeDirectory("root/Applications/POSIX/lib/linker"); - MakeDirectory("root/Essence"); + MakeDirectory("root/" SYSTEM_FOLDER_NAME); if (!skipHeaderGeneration) { HeaderGeneratorMain(1, NULL);