Skip to content

Commit 502603f

Browse files
author
ligges
committed
Bug fix: aspell ignored R level dictionaries on Windows
git-svn-id: https://svn.r-project.org/R/trunk@87775 00db46b3-68df-0310-9c12-caf00c1e9a41
1 parent 2efd0c0 commit 502603f

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/library/utils/R/aspell.R

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,16 @@ function(files, filter, control = list(), encoding = "unknown",
110110
aspell_write_personal_dictionary_file(words, personal,
111111
program = program)
112112
## </FIXME>
113+
114+
## For aspell (only!) on Windows, we need the special Unix path form
115+
## such as /c/path/to/dictionary
116+
## known from, e.g., msys2 to specify the personal dictionary:
117+
if(grepl("aspell", program)){
118+
personal <- normalizePath(personal, winslash="/")
119+
if(grepl("^.:", personal))
120+
personal <- gsub("^(.):(.*)$", "/\\1\\2", personal)
121+
}
122+
113123
control <- c(control, "-p", shQuote(personal))
114124
}
115125
}
@@ -1412,7 +1422,11 @@ function(x, out, language = "en", program = NULL)
14121422
header <- NULL
14131423
}
14141424

1415-
writeLines(c(header, x), out, useBytes = TRUE)
1425+
## we need Unix line endings even on Windows
1426+
## (at least for aspell, and works for hunspell, too):
1427+
outfile <- file(out, open = "wb")
1428+
on.exit(close(outfile))
1429+
writeLines(c(header, x), outfile, useBytes = TRUE)
14161430
}
14171431

14181432
## For reading package defaults:

0 commit comments

Comments
 (0)