Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catch errors when removing .root.c #1950

Merged
merged 1 commit into from
Oct 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion compiler/ActonCompiler.hs
Original file line number Diff line number Diff line change
Expand Up @@ -307,12 +307,16 @@ removeOrphanFiles dir = do
-- anyway since the file is so small. So check if filename ends with
-- ".root.c" and remove it!
iff (takeExtension file == ".c" && takeExtension (takeBaseName file) == ".root") $ do
removeFile (dir </> file)
removeIfExists (dir </> file)

-- Check if there is a corresponding .act file in the "src" directory.
srcExists <- doesFileExist srcFile
-- If the .act file doesn't exist, remove the file in the "out" directory.
when (not srcExists) $ removeFile (dir </> file)
where
removeIfExists f = removeFile f `catch` handleNotExists
handleNotExists :: IOException -> IO ()
handleNotExists _ = return ()

compileFiles :: C.CompileOptions -> [String] -> IO ()
compileFiles opts srcFiles = do
Expand Down
Loading