adjusted regexes relative path in rule #592
This commit is contained in:
@@ -3,6 +3,8 @@ extern crate csv;
|
|||||||
extern crate regex;
|
extern crate regex;
|
||||||
|
|
||||||
use crate::detections::configs;
|
use crate::detections::configs;
|
||||||
|
use crate::detections::configs::CURRENT_EXE_PATH;
|
||||||
|
|
||||||
use termcolor::Color;
|
use termcolor::Color;
|
||||||
|
|
||||||
use tokio::runtime::Builder;
|
use tokio::runtime::Builder;
|
||||||
@@ -66,7 +68,12 @@ pub fn value_to_string(value: &Value) -> Option<String> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn read_txt(filename: &str) -> Result<Vec<String>, String> {
|
pub fn read_txt(filename: &str) -> Result<Vec<String>, String> {
|
||||||
let f = File::open(filename);
|
let filepath = if filename.starts_with("./") {
|
||||||
|
CURRENT_EXE_PATH.join(filename).to_str().unwrap().to_string()
|
||||||
|
} else {
|
||||||
|
filename.to_string()
|
||||||
|
};
|
||||||
|
let f = File::open(filepath);
|
||||||
if f.is_err() {
|
if f.is_err() {
|
||||||
let errmsg = format!("Cannot open file. [file:{}]", filename);
|
let errmsg = format!("Cannot open file. [file:{}]", filename);
|
||||||
return Result::Err(errmsg);
|
return Result::Err(errmsg);
|
||||||
|
|||||||
Reference in New Issue
Block a user