feat: put the converted files into a subfolder
This commit is contained in:
parent
ffd6e40d0b
commit
537fdfd40c
1 changed files with 12 additions and 1 deletions
|
@ -201,11 +201,13 @@ struct LogoData {
|
||||||
fn get_logos(config: &Config, config_toml: &ConfigToml) -> Vec<LogoData> {
|
fn get_logos(config: &Config, config_toml: &ConfigToml) -> Vec<LogoData> {
|
||||||
let folder = format!("{}/open-governance/{}", &config.home, &config_toml.source.directory);
|
let folder = format!("{}/open-governance/{}", &config.home, &config_toml.source.directory);
|
||||||
let folder_path = PathBuf::from(&folder);
|
let folder_path = PathBuf::from(&folder);
|
||||||
|
let mut folder_output = folder_path.clone();
|
||||||
|
folder_output.push("converted");
|
||||||
let paths = fs::read_dir(folder).unwrap();
|
let paths = fs::read_dir(folder).unwrap();
|
||||||
|
|
||||||
let args = Args{
|
let args = Args{
|
||||||
input: folder_path.clone(),
|
input: folder_path.clone(),
|
||||||
output: folder_path.clone(),
|
output: folder_output,
|
||||||
colors: String::from(""),
|
colors: String::from(""),
|
||||||
width: 1024,
|
width: 1024,
|
||||||
height: 1024,
|
height: 1024,
|
||||||
|
@ -219,6 +221,10 @@ fn get_logos(config: &Config, config_toml: &ConfigToml) -> Vec<LogoData> {
|
||||||
let path_local2 = tmp.path().to_owned();
|
let path_local2 = tmp.path().to_owned();
|
||||||
let name = path_local2.file_name().unwrap().to_owned();
|
let name = path_local2.file_name().unwrap().to_owned();
|
||||||
let mut path = tmp.path();
|
let mut path = tmp.path();
|
||||||
|
|
||||||
|
if path.is_dir() {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
match tmp.path().extension() {
|
match tmp.path().extension() {
|
||||||
None => {}
|
None => {}
|
||||||
|
@ -226,6 +232,11 @@ fn get_logos(config: &Config, config_toml: &ConfigToml) -> Vec<LogoData> {
|
||||||
if ext == "svg" {
|
if ext == "svg" {
|
||||||
let mut path_new = path_local.clone();
|
let mut path_new = path_local.clone();
|
||||||
path_new.set_extension("png");
|
path_new.set_extension("png");
|
||||||
|
let filename_tmp = path_new.clone();
|
||||||
|
let filename = filename_tmp.file_name().unwrap_or_default();
|
||||||
|
path_new.pop();
|
||||||
|
path_new.push("converted");
|
||||||
|
path_new.push(filename);
|
||||||
|
|
||||||
// check if exists
|
// check if exists
|
||||||
match r.render(&path_local, &args) {
|
match r.render(&path_local, &args) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue