Skip to content

Commit 77c1f63

Browse files
committed
Fix temp file delete
1 parent 9c88a51 commit 77c1f63

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

commands/parse_test.go

+11-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ func TestCreateDirectoryStructure(t *testing.T) {
8383
Version: "1.0",
8484
Author: "MaxHeap",
8585
}
86-
rootDir := os.TempDir()
86+
rootDir := path.Join(os.TempDir(), "egor")
87+
CreateDirectory(rootDir)
8788
defer DeleteDir(rootDir)
8889

8990
_, err := CreateDirectoryStructure(task, configuration, rootDir)
@@ -98,3 +99,12 @@ func TestCreateDirectoryStructure(t *testing.T) {
9899
assert.FileExists(t, path.Join(taskDir, "inputs", "test-0.in"))
99100
assert.FileExists(t, path.Join(taskDir, "outputs", "test-0.ans"))
100101
}
102+
103+
func CreateDirectory(path string) error {
104+
if _, err := os.Stat(path); os.IsNotExist(err) {
105+
if err := os.Mkdir(path, 0777); err != nil {
106+
return err
107+
}
108+
}
109+
return nil
110+
}

0 commit comments

Comments
 (0)