From 97028b02613f29764ccd91b650ebc124e53ecafc Mon Sep 17 00:00:00 2001
From: Yifan Zhao <yifanz16@illinois.edu>
Date: Mon, 22 Mar 2021 10:30:56 -0500
Subject: [PATCH] Throw error when folder already exists

---
 hpvm/projects/torch2hpvm/torch2hpvm/compile.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hpvm/projects/torch2hpvm/torch2hpvm/compile.py b/hpvm/projects/torch2hpvm/torch2hpvm/compile.py
index f0d8c3b131..57566db5aa 100644
--- a/hpvm/projects/torch2hpvm/torch2hpvm/compile.py
+++ b/hpvm/projects/torch2hpvm/torch2hpvm/compile.py
@@ -55,7 +55,7 @@ class ModelExporter:
         self.dfg = DFG(onnx_model.graph)
 
         output_dir = Path(output_dir).absolute()
-        os.makedirs(output_dir, exist_ok=True)
+        os.makedirs(output_dir, exist_ok=False)  # Will throw if already existss
         self.weight_dir = output_dir / self.weight_dir_name
         self.weight_dir.mkdir(exist_ok=True)
         self.codefile = output_dir / self.source_file_name
-- 
GitLab