mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-11 07:17:58 +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;
|
void *buffer;
|
||||||
FILE *f;
|
FILE *f;
|
||||||
|
|
||||||
|
/* Try in the optional kernel path first, defaults to PREFIX */
|
||||||
strcpy(fullpath, opt_kernel_path);
|
strcpy(fullpath, opt_kernel_path);
|
||||||
strcat(fullpath, filename);
|
strcat(fullpath, filename);
|
||||||
|
|
||||||
/* Try in the optional kernel path or installed prefix first */
|
|
||||||
f = fopen(fullpath, "rb");
|
f = fopen(fullpath, "rb");
|
||||||
if (!f) {
|
if (!f) {
|
||||||
/* Then try from the path sgminer was called */
|
/* Then try from the path sgminer was called */
|
||||||
@ -52,12 +51,20 @@ char *file_contents(const char *filename, int *length)
|
|||||||
strcat(fullpath, filename);
|
strcat(fullpath, filename);
|
||||||
f = fopen(fullpath, "rb");
|
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 */
|
/* Finally try opening it directly */
|
||||||
if (!f)
|
if (!f)
|
||||||
f = fopen(filename, "rb");
|
f = fopen(filename, "rb");
|
||||||
|
|
||||||
if (!f) {
|
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;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7695,8 +7695,11 @@ int main(int argc, char *argv[])
|
|||||||
#else
|
#else
|
||||||
timeBeginPeriod(1);
|
timeBeginPeriod(1);
|
||||||
#endif
|
#endif
|
||||||
|
/* opt_kernel_path defaults to SGMINER_PREFIX */
|
||||||
opt_kernel_path = alloca(PATH_MAX);
|
opt_kernel_path = alloca(PATH_MAX);
|
||||||
strcpy(opt_kernel_path, SGMINER_PREFIX);
|
strcpy(opt_kernel_path, SGMINER_PREFIX);
|
||||||
|
|
||||||
|
/* sgminer_path is current dir */
|
||||||
sgminer_path = alloca(PATH_MAX);
|
sgminer_path = alloca(PATH_MAX);
|
||||||
s = strdup(argv[0]);
|
s = strdup(argv[0]);
|
||||||
strcpy(sgminer_path, dirname(s));
|
strcpy(sgminer_path, dirname(s));
|
||||||
|
Loading…
Reference in New Issue
Block a user