Skip to content

Commit 854f829

Browse files
committed
fixes
1 parent 80ce3e8 commit 854f829

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

tmc-langs-util/src/error.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
//! Contains the crate error type
22
3-
#[cfg(unix)]
43
use std::path::PathBuf;
54
use thiserror::Error;
65
use tmc_langs_framework::error::FileIo;
76

7+
use crate::task_executor::ModeBits;
8+
89
#[derive(Debug, Error)]
910
pub enum UtilError {
1011
#[error("Failed to create temporary file")]
@@ -31,12 +32,8 @@ pub enum UtilError {
3132
#[error("Error while writing file to zip")]
3233
ZipWrite(#[source] std::io::Error),
3334

34-
#[error("Unsupported source backend")]
35-
UnsupportedSourceBackend,
3635
#[error("Path {0} contained a dash '-' which is currently not allowed")]
3736
InvalidDirectory(PathBuf),
38-
#[error("The cache path ({0}) must be inside the rails root path ({1})")]
39-
CacheNotInRailsRoot(PathBuf, PathBuf),
4037

4138
#[error(transparent)]
4239
TmcError(#[from] tmc_langs_framework::TmcError),
@@ -52,7 +49,7 @@ pub enum UtilError {
5249
NixPermissionChange(PathBuf, #[source] nix::Error),
5350
#[cfg(unix)]
5451
#[error("Invalid chmod flag: {0}")]
55-
NixFlag(u32),
52+
NixFlag(ModeBits),
5653

5754
#[error(transparent)]
5855
DynError(#[from] Box<dyn 'static + std::error::Error + Sync + Send>),

tmc-langs-util/src/task_executor.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ mod submission_processing;
66
mod tar_helper;
77
mod tmc_zip;
88

9-
pub use self::course_refresher::{refresh_course, RefreshData, RefreshExercise};
9+
pub use self::course_refresher::{refresh_course, ModeBits, RefreshData, RefreshExercise};
1010
pub use self::submission_packaging::{OutputFormat, TmcParams};
1111

1212
use crate::error::UtilError;

tmc-langs-util/src/task_executor/course_refresher.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ use std::path::{Path, PathBuf};
1313
use tmc_langs_framework::{command::TmcCommand, file_util, subprocess::Redirection};
1414
use walkdir::WalkDir;
1515

16+
#[cfg(unix)]
17+
pub type ModeBits = nix::sys::stat::mode_t;
18+
#[cfg(not(unix))]
19+
pub type ModeBits = u32;
20+
1621
#[derive(Debug, Serialize, Deserialize)]
1722
#[serde(rename_all = "kebab-case")]
1823
pub struct RefreshData {
@@ -359,7 +364,7 @@ fn set_permissions(path: &Path) -> Result<(), UtilError> {
359364
use nix::sys::stat;
360365
use std::os::unix::io::AsRawFd;
361366

362-
let chmod = 0o555; // octal, read and execute permissions for all users
367+
let chmod: ModeBits = 0o555; // octal, read and execute permissions for all users
363368
for entry in WalkDir::new(path) {
364369
let entry = entry?;
365370
let file = file_util::open_file(entry.path())?;

0 commit comments

Comments
 (0)