| 4680 | } |
| 4681 | |
| 4682 | void get_system_environment() |
| 4683 | { |
| 4684 | // The player's name |
| 4685 | SysEnv.crawl_name = check_string(getenv("CRAWL_NAME")); |
| 4686 | |
| 4687 | // The directory which contains init.txt, macro.txt, morgue.txt |
| 4688 | // This should end with the appropriate path delimiter. |
| 4689 | SysEnv.crawl_dir = check_string(getenv("CRAWL_DIR")); |
| 4690 | |
| 4691 | #if defined(TARGET_OS_MACOSX) && !defined(DGAMELAUNCH) |
| 4692 | if (SysEnv.crawl_dir.empty()) |
| 4693 | { |
| 4694 | SysEnv.crawl_dir |
| 4695 | = _user_home_subpath("Library/Application Support/" CRAWL); |
| 4696 | } |
| 4697 | #endif |
| 4698 | |
| 4699 | #ifdef __HAIKU__ |
| 4700 | if (SysEnv.crawl_dir.empty()) |
| 4701 | { |
| 4702 | char path[B_PATH_NAME_LENGTH]; |
| 4703 | find_directory(B_USER_SETTINGS_DIRECTORY, |
| 4704 | 0, |
| 4705 | false, |
| 4706 | path, |
| 4707 | B_PATH_NAME_LENGTH); |
| 4708 | |
| 4709 | SysEnv.crawl_dir = catpath(std::string(path), "/crawl"); |
| 4710 | } |
| 4711 | #endif |
| 4712 | |
| 4713 | #ifdef SAVE_DIR_PATH |
| 4714 | if (SysEnv.crawl_dir.empty()) |
| 4715 | SysEnv.crawl_dir = SAVE_DIR_PATH; |
| 4716 | #endif |
| 4717 | |
| 4718 | #ifdef __ANDROID__ |
| 4719 | if (SysEnv.crawl_dir.empty()) |
| 4720 | { |
| 4721 | SysEnv.crawl_dir = SDL_AndroidGetExternalStoragePath(); |
| 4722 | chdir(SysEnv.crawl_dir.c_str()); |
| 4723 | } |
| 4724 | #endif |
| 4725 | |
| 4726 | #ifdef DGL_SIMPLE_MESSAGING |
| 4727 | // Enable DGL_SIMPLE_MESSAGING only if SIMPLEMAIL and MAIL are set. |
| 4728 | const char *simplemail = getenv("SIMPLEMAIL"); |
| 4729 | if (simplemail && strcmp(simplemail, "0")) |
| 4730 | { |
| 4731 | const char *mail = getenv("MAIL"); |
| 4732 | SysEnv.messagefile = mail? mail : ""; |
| 4733 | } |
| 4734 | #endif |
| 4735 | |
| 4736 | // The full path to the init file -- this overrides CRAWL_DIR. |
| 4737 | SysEnv.crawl_rc = check_string(getenv("CRAWL_RC")); |
| 4738 | |
| 4739 | #ifdef UNIX |
no test coverage detected