/** * returns the full-pathname of unit * * @param name unit's name * @param file buffer to store the filename * @return non-zero on success */ int find_unit_path(const char *name, char *file) { strcpy(file, name); strcat(file, ".bas"); // find in unitpath if (getenv("UNITPATH")) { if (sys_search_path(getenv("UNITPATH"), file, file)) { return 1; } } // find in current directory if (access(file, R_OK) == 0) { return 1; } // find in program launch directory if (gsb_bas_dir[0]) { strcpy(file, gsb_bas_dir); strcat(file, name); strcat(file, ".bas"); if (access(file, R_OK) == 0) { return 1; } } return 0; }
/** * returns the full-pathname of unit * * @param name unit's name * @param file buffer to store the filename * @return non-zero on success */ int find_unit_path(const char *name, char *file) { strcpy(file, name); strcat(file, ".bas"); // find in unitpath if (getenv("SBASICPATH")) { if (sys_search_path(getenv("SBASICPATH"), file, file)) { return 1; } } // find in program launch directory if (gsb_bas_dir[0] && sys_search_path(gsb_bas_dir, file, file)) { return 1; } // find in current directory if (sys_search_path(".", file, file)) { return 1; } return 0; }