Small Debug Fixes

This commit is contained in:
TheBrokenRail 2022-03-09 22:08:47 -05:00
parent 742ead51e1
commit 5d8a1e4230
5 changed files with 9 additions and 8 deletions

View File

@ -1,10 +1,6 @@
# Manual Installation
[Download Packages Here](https://jenkins.thebrokenrail.com/job/minecraft-pi-reborn/job/master/lastSuccessfulBuild/artifact/out/)
## Supported Distributions
* Ubuntu 20.04+
* Debian Bullseye+
## Picking A Package
### Name Format

View File

@ -31,9 +31,12 @@ static void trim(char **value) {
*value = &(*value)[1];
}
}
static void set_and_print_env(const char *name, char *value) {
void set_and_print_env(const char *name, char *value) {
// Set Variable With No Trailing Colon
trim(&value);
static const char *unmodified_name_prefix = "MCPI_";
if (strncmp(unmodified_name_prefix, name, strlen(unmodified_name_prefix)) != 0) {
trim(&value);
}
#ifdef DEBUG
// Print New Value

View File

@ -4,6 +4,8 @@
extern "C" {
#endif
void set_and_print_env(const char *name, char *value);
void bootstrap(int argc, char *argv[]);
#ifdef __cplusplus

View File

@ -92,7 +92,7 @@ static void run_command_and_set_env(const char *env_name, char *command[]) {
output[length - 1] = '\0';
}
// Set
setenv(env_name, output, 1);
set_and_print_env(env_name, output);
}
// Check Return Code
if (return_code != 0) {

View File

@ -6,7 +6,7 @@
int main(int argc, char *argv[]) {
// Set Home To Current Directory, So World Data Is Stored There
char *launch_directory = getcwd(NULL, 0);
setenv("HOME", launch_directory, 1);
set_and_print_env("HOME", launch_directory);
free(launch_directory);
// Bootstrap