File: var-lib-agda

package info (click to toggle)
agda 2.6.4.3-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 8,208 kB
  • sloc: haskell: 103,159; lisp: 3,761; yacc: 2,170; javascript: 614; perl: 15; makefile: 14
file content (31 lines) | stat: -rw-r--r-- 1,516 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
See https://github.com/agda/agda/issues/2804

Index: b/src/full/Agda/Interaction/Library.hs
===================================================================
--- a/src/full/Agda/Interaction/Library.hs
+++ b/src/full/Agda/Interaction/Library.hs
@@ -323,7 +323,7 @@ getInstalledLibraries
   -> LibM [AgdaLibFile] -- ^ Content of library files.  (Might have empty @LibName@s.)
 getInstalledLibraries overrideLibFile = mkLibM [] $ do
     filem <- liftIO $ runExceptT $ getLibrariesFile overrideLibFile
-    case filem of
+    userlibs <- case filem of
       Left theOverrideLibFile -> do
         raiseErrors' [ LibrariesFileNotFound theOverrideLibFile ]
         return []
@@ -332,9 +332,15 @@ getInstalledLibraries overrideLibFile =
           ls    <- liftIO $ stripCommentLines <$> UTF8.readFile (lfPath file)
           files <- liftIO $ sequence [ (i, ) <$> expandEnvironmentVariables s | (i, s) <- ls ]
           parseLibFiles (Just file) $ nubOn snd files
+    systemlibs <- ifNotM (liftIO $ doesDirectoryExist systemLibDir) (return []) $ do
+      files <- liftIO $ filter isLibFile <$> listDirectory systemLibDir
+      parseLibFiles Nothing $ zip [1..] $ map (systemLibDir </>) files
+    return $ userlibs ++ systemlibs
   `catchIO` \ e -> do
     raiseErrors' [ ReadError e "Failed to read installed libraries." ]
     return []
+  where systemLibDir = "/var/lib/agda"
+        isLibFile fn = takeExtension fn == ".agda-lib" && not ("." `List.isPrefixOf` fn)
 
 -- | Parse the given library files.
 --