tangled
alpha
login
or
join now
tholps.site
/
skidmark
0
fork
atom
Tholp's bespoke website generator
0
fork
atom
overview
issues
pulls
pipelines
Check parent folders for project file if missing
Tholp1
10 months ago
3a16cd22
55632975
+38
-1
2 changed files
expand all
collapse all
unified
split
src
main.rs
projectparse.rs
+27
-1
src/main.rs
···
10
10
env,
11
11
fs::{self, File},
12
12
io::Write,
13
13
+
path::PathBuf,
13
14
process::{exit, Output},
14
15
};
15
16
use stringtools::{
···
21
22
static DELIMITERS: [char; 10] = [' ', '\n', '\t', '(', ')', '{', '}', '\\', '\'', '\"'];
22
23
23
24
fn main() {
24
24
-
let mut project = parse_project(env::current_dir().unwrap().as_path());
25
25
+
let mut project_folder = PathBuf::from(env::current_dir().unwrap().as_path());
26
26
+
27
27
+
let mut project_path = project_folder.clone();
28
28
+
project_path.push("skidmark.toml");
29
29
+
30
30
+
while !project_path.exists() || project_path.is_dir() {
31
31
+
let ok = project_folder.pop();
32
32
+
if !ok {
33
33
+
println!("No skidmark.toml project file found in this folder or ancestors.");
34
34
+
exit(1);
35
35
+
}
36
36
+
project_path = project_folder.clone();
37
37
+
project_path.push("skidmark.toml");
38
38
+
}
39
39
+
println!("Operatting with {:?}", &project_path.as_os_str());
40
40
+
assert!(env::set_current_dir(&project_folder).is_ok());
41
41
+
42
42
+
let mut project = parse_project(&project_path);
43
43
+
44
44
+
let mut num = 0;
45
45
+
46
46
+
for group in &project.filegroups {
47
47
+
num = num + group.files.len();
48
48
+
}
49
49
+
50
50
+
println!("Proccesing {} files.", num);
25
51
for group in &mut project.filegroups {
26
52
for infile in &mut group.files {
27
53
process_file(infile, &mut project.context);
+11
src/projectparse.rs
···
32
32
33
33
pub struct ProjectContext {
34
34
pub filemap: Vec<PathBuf>, // mapped to index
35
35
+
//variables later
35
36
}
36
37
37
38
macro_rules! get_table_bool_or_default {
···
147
148
let mut new_file = crate::types::InputFile::new();
148
149
new_file.file_input = project.settings.input_folder.clone();
149
150
new_file.file_input.push(filename);
151
151
+
152
152
+
new_file.file_htmlout = project.settings.output_folder.clone();
153
153
+
new_file.file_htmlout.push(filename);
154
154
+
new_file.file_htmlout.set_extension("html");
155
155
+
156
156
+
new_file.file_skidout = new_file.file_htmlout.clone();
157
157
+
new_file.file_skidout.set_extension("sko");
158
158
+
150
159
group.files.push(new_file);
151
160
}
152
161
}
162
162
+
163
163
+
project.filegroups.push(group);
153
164
}
154
165
155
166
return project;