Add terminal links

This commit is contained in:
mo8it
2024-04-14 02:41:19 +02:00
parent 5c0073a948
commit bee62c89de
10 changed files with 59 additions and 28 deletions
+4 -6
View File
@@ -1,6 +1,6 @@
use anyhow::{bail, Context, Error, Result};
use serde::Deserialize;
use std::{fs, path::PathBuf};
use std::fs;
// The mode of the exercise.
#[derive(Deserialize, Copy, Clone)]
@@ -28,14 +28,12 @@ pub struct ExerciseInfo {
}
impl ExerciseInfo {
pub fn path(&self) -> PathBuf {
let path = if let Some(dir) = &self.dir {
pub fn path(&self) -> String {
if let Some(dir) = &self.dir {
format!("exercises/{dir}/{}.rs", self.name)
} else {
format!("exercises/{}.rs", self.name)
};
PathBuf::from(path)
}
}
}