diff --git a/kattcmd/commands/compile.py b/kattcmd/commands/compile.py index 955472d07b6fead8bc085314590d58d51db2ca60..6ae35a13afa10ab9dbadb53b1ea2d4149813aec2 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'