summaryrefslogtreecommitdiff
path: root/doc/bugs/git-annex_fails_to_start_when_nautilus_script_directory_is_missing.mdwn
blob: e3441489d20cfbc04f3265b66d11fda901272243 (plain)
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
### Please describe the problem.
Starting the webapp fails if the Nautilus scripts directory doesn't exist.

### What steps will reproduce the problem?

[[!format sh """
$ mv ~/.local/share/nautilus ~/.local/share/nautilus.bak
$ git-annex webapp

git-annex: /home/brunksn/.local/share/nautilus/scripts/git-annex get: openFile: does not exist (No such file or directory)
failed
git-annex: webapp: 1 failed
"""]]

### What version of git-annex are you using? On what operating system?
5.20140402, Debian testing

### Please provide any additional information below.

Workaround for users without Gnome/Nautilus:
[[!format sh """
$ mkdir -p ~/.local/share/nautilus
"""]]

It seems git-annex tries to create the scripts without checking if the actually directory exists. One solution would be to just create it if it doesn't exist or to only write the scripts if it exists already. Patch for the latter below. Works for me but my haskell knowledge is still very limited.

By the way, what is the preferred way to contribute patches for git-annex? I couldn't find any information about that on the website.

[[!format diff """
diff --git a/Assistant/Install.hs b/Assistant/Install.hs
index 4d02c0e..883ca48 100644
--- a/Assistant/Install.hs
+++ b/Assistant/Install.hs
@@ -87,8 +87,9 @@ installNautilus :: FilePath -> IO ()
 #ifdef linux_HOST_OS
 installNautilus program = do
        scriptdir <- (\d -> d </> "nautilus" </> "scripts") <$> userDataDir
-       genscript scriptdir "get"
-       genscript scriptdir "drop"
+       whenM (doesDirectoryExist scriptdir) $ do
+               genscript scriptdir "get"
+               genscript scriptdir "drop"
   where
        genscript scriptdir action =
                installscript (scriptdir </> scriptname action) $ unlines
"""]]

> [[applied|done]]. thanks! That's a fine way to send a small patch, or
> make a git branch somewhere for a larger one. --[[Joey]]