From fbfb939b001e3d86cb892cdd423f7f1171742575 Mon Sep 17 00:00:00 2001 From: Henke Adolfsson <catears13@gmail.com> Date: Tue, 13 Mar 2018 06:52:29 +0100 Subject: [PATCH] Remove old cpp files and return path relative to cwd --- kattcmd/commands/compile.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/kattcmd/commands/compile.py b/kattcmd/commands/compile.py index 955472d..6ae35a1 100644 --- a/kattcmd/commands/compile.py +++ b/kattcmd/commands/compile.py @@ -94,15 +94,19 @@ def CompileCpp(bus, problemname): os.chdir(old_cwd) return - if os.path.exists(output_binary): os.chdir(old_cwd) + # Remove unused files + for path in paths: + os.remove(path) bus.call('kattcmd:compile:cpp-compiled', output_binary) - return output_binary + relative_path = os.path.join('build', problemname, output_binary) + return relative_path else: os.chdir(old_cwd) bus.call('kattcmd:compile:cpp-compile-failed', compile_command) + def FindCppCompileCommand(bus): '''Returns either the user-set compile command or the default one.''' default_compile = 'g++ -std=c++14 -O2 -pedantic -Wall FILES -o BINARY' -- GitLab