Skip to content

Commit de1cfe8

Browse files
authored
Removed calls to quit()
It's very unlikely that anyone would want to call quit() just because there is an error. That quits the R session which is very disruptive. I've replaced those with error() calls.
1 parent 4a4eb0a commit de1cfe8

File tree

1 file changed

+18
-22
lines changed

1 file changed

+18
-22
lines changed

R/svm.R

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,22 @@
11
check_location <- function(){
2-
if(Sys.info()['sysname'] == 'Windows'){
3-
if(!file.exists("../build/bin/Debug/thundersvm.dll")){
4-
print("Please build the library first!")
5-
quit()
6-
}
7-
dyn.load("../build/bin/Debug/thundersvm.dll")
8-
} else if(Sys.info()['sysname'] == 'Linux'){
9-
if(!file.exists("../build/lib/libthundersvm.so")){
10-
print("Please build the library first!")
11-
quit()
12-
}
13-
dyn.load("../build/lib/libthundersvm.so")
14-
} else if(Sys.info()['sysname'] == 'Darwin'){
15-
if(!file.exists("../build/lib/libthundersvm.dylib")){
16-
print("Please build the library first!")
17-
quit()
18-
}
19-
dyn.load("../build/lib/libthundersvm.dylib")
20-
} else{
21-
print("OS not supported!")
22-
quit()
23-
}
2+
if(Sys.info()['sysname'] == 'Windows'){
3+
if(!file.exists("../build/bin/Debug/thundersvm.dll")){
4+
stop("Please build the library first!")
5+
}
6+
dyn.load("../build/bin/Debug/thundersvm.dll")
7+
} else if(Sys.info()['sysname'] == 'Linux'){
8+
if(!file.exists("../build/lib/libthundersvm.so")){
9+
stop("Please build the library first!")
10+
}
11+
dyn.load("../build/lib/libthundersvm.so")
12+
} else if(Sys.info()['sysname'] == 'Darwin'){
13+
if(!file.exists("../build/lib/libthundersvm.dylib")){
14+
stop("Please build the library first!")
15+
}
16+
dyn.load("../build/lib/libthundersvm.dylib")
17+
} else{
18+
stop("OS not supported!")
19+
}
2420
}
2521
check_location() # Run this when the file is sourced
2622

0 commit comments

Comments
 (0)