Skip to content

Commit 9f616cb

Browse files
committed
refactor: extract default directory names to a constant array
1 parent 5b0f3cb commit 9f616cb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/file_manager/git.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use std::path::PathBuf;
66
use tokio::fs;
77

88
const UPLOAD_DIR: &str = "uploads";
9+
const DEFAULT_DIRECTORIES: [&str; 3] = ["solutions", "tests", "statements"];
910

1011
#[derive(Debug)]
1112
struct GitManager {
@@ -121,8 +122,7 @@ impl GitManager {
121122

122123
async fn create_default_directories(&self) -> Result<()> {
123124
let base_path = PathBuf::from(UPLOAD_DIR).join(self.problem_id.to_string());
124-
let directories = ["solutions", "tests", "statements"];
125-
for dir in directories {
125+
for dir in DEFAULT_DIRECTORIES {
126126
let path = base_path.join(dir);
127127
fs::create_dir_all(path)
128128
.await

0 commit comments

Comments
 (0)