Jump to content

Build Source Code


79 posts in this topic

Recommended Posts

Posted

its kinda messy because I'm working on an update, but I cleaned it up to the best of my ability. if you see a floating variable or some code thats never being used just ignore it

 

Hidden Content

    #include <dirent.h>
    #include <stdio.h>
    #include <iostream>
    
    int main(int argc, const char **argv, char **envp) {
    DIR *directory;
    FILE *dirConfig;
    struct dirent *dir;
    char specifiedDir[128];
    int dirIndex = 0;
    const char *filenames[512];
    const char *mp = " && make package ";
    
    system("clear");
    
    if(access("/var/mobile/dirConfig.txt", F_OK) == -1){
    memset(&specifiedDir[0], NULL, sizeof(specifiedDir));
    
    printf("Looks like it's your first time running Build. Please enter your project directory: ");
    scanf("%s", &specifiedDir);
    
    dirConfig = fopen("/var/mobile/dirConfig.txt", "w+");
    fprintf(dirConfig, specifiedDir);
    
    printf("Build has been configured. Please re-run Build.\n");
    
    return 0;
    }
    
    //clean up the uninitialized trash that the specifiedDir array holds
    memset(&specifiedDir[0], NULL, sizeof(specifiedDir));
    
    dirConfig = fopen("/var/mobile/dirConfig.txt", "r+");
    fscanf(dirConfig, "%s", specifiedDir);
    fclose(dirConfig);
    
    directory = opendir(specifiedDir);
    
    if(directory){
    while((dir = readdir(directory)) != 0){
    const char *name = 
    filenames[dirIndex] = dir->d_name;
    
    dirIndex++;
    
    printf("[%d.] %s\n", dirIndex, dir->d_name);
    }
    
    closedir(directory);
    }
    
    int selection = 0;
    
    printf("Type the number of the project you want to compile: ");
    scanf("%d", &selection);
    
    while(selection>dirIndex){
    printf("Bad input.\n");
    printf("Type the number of the project you want to compile: ");
    scanf("%d", &selection);
    }
    
    char command[256];
    
    //clean up the uninitialized trash that the specifiedDir array holds
    memset(&command[0], NULL, sizeof(command));
    
    strcat(command, "cd ");
    strcat(command, specifiedDir);
    strcat(command, "/");
    strcat(command, filenames[selection-1]);
    strcat(command, mp);
    
    //run the command to compile the tweak
    system(command);
    
    return 0;
    }
×
  • Create New...

Important Information

We would like to place cookies on your device to help make this website better. The website cannot give you the best user experience without cookies. You can accept or decline our cookies. You may also adjust your cookie settings. Privacy Policy - Guidelines