Skip to content

Commit 02c6c78

Browse files
authored
Merge pull request #92 from traP-jp/fix/#91-file-drop-symlink
droptraitを入れました
2 parents 2f6ba98 + 77b17ef commit 02c6c78

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

judge_control_app/src/custom_rc/readonly_file.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,20 @@ impl ReadonlyFile {
2727
}
2828
}
2929

30+
impl Drop for ReadonlyFile {
31+
fn drop(&mut self) {
32+
let result = std::fs::remove_file(&self.path).context(format!(
33+
"Failed to remove file while dropping ReadonlyFile : {:?}",
34+
self.path
35+
));
36+
match result {
37+
Ok(_) => {}
38+
Err(e) => {
39+
eprintln!("{:?}", e);
40+
}
41+
}
42+
}
43+
}
3044
impl super::File for ReadonlyFile {
3145
fn path(&self) -> PathBuf {
3246
self.path.clone()

0 commit comments

Comments
 (0)