mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-10 23:08:07 +00:00
kernel: search in pwd
/kernel/ for kernels.
Closes https://github.com/veox/sgminer/issues/49.
This commit is contained in:
parent
d203dddabb
commit
e123cc20c3
13
ocl.c
13
ocl.c
@ -41,10 +41,9 @@ char *file_contents(const char *filename, int *length)
|
||||
void *buffer;
|
||||
FILE *f;
|
||||
|
||||
/* Try in the optional kernel path first, defaults to PREFIX */
|
||||
strcpy(fullpath, opt_kernel_path);
|
||||
strcat(fullpath, filename);
|
||||
|
||||
/* Try in the optional kernel path or installed prefix first */
|
||||
f = fopen(fullpath, "rb");
|
||||
if (!f) {
|
||||
/* Then try from the path sgminer was called */
|
||||
@ -52,12 +51,20 @@ char *file_contents(const char *filename, int *length)
|
||||
strcat(fullpath, filename);
|
||||
f = fopen(fullpath, "rb");
|
||||
}
|
||||
if (!f) {
|
||||
/* Then from `pwd`/kernel/ */
|
||||
strcpy(fullpath, sgminer_path);
|
||||
strcat(fullpath, "kernel/");
|
||||
strcat(fullpath, filename);
|
||||
f = fopen(fullpath, "rb");
|
||||
}
|
||||
/* Finally try opening it directly */
|
||||
if (!f)
|
||||
f = fopen(filename, "rb");
|
||||
|
||||
if (!f) {
|
||||
applog(LOG_ERR, "Unable to open %s or %s for reading", filename, fullpath);
|
||||
applog(LOG_ERR, "Unable to open %s or %s for reading",
|
||||
filename, fullpath);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -7695,8 +7695,11 @@ int main(int argc, char *argv[])
|
||||
#else
|
||||
timeBeginPeriod(1);
|
||||
#endif
|
||||
/* opt_kernel_path defaults to SGMINER_PREFIX */
|
||||
opt_kernel_path = alloca(PATH_MAX);
|
||||
strcpy(opt_kernel_path, SGMINER_PREFIX);
|
||||
|
||||
/* sgminer_path is current dir */
|
||||
sgminer_path = alloca(PATH_MAX);
|
||||
s = strdup(argv[0]);
|
||||
strcpy(sgminer_path, dirname(s));
|
||||
|
Loading…
Reference in New Issue
Block a user