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

Backslash confusion on Windows with shared lib #237

Closed
christophsax opened this issue Nov 22, 2019 · 1 comment
Closed

Backslash confusion on Windows with shared lib #237

christophsax opened this issue Nov 22, 2019 · 1 comment
Labels

Comments

@christophsax
Copy link
Owner

christophsax commented Nov 22, 2019

Problem

seasonal does not wrap x13.bin in normalizPath and uses invalid paths on some Windows systems.

E.g., this does not work

\\\\zzz.loc/soz/users/zzz/Dokumente/R/win-library/3.5/x13binary/bin/x13ashtml.exe

Workaround

Repair X13_PATH so it contains only /:

library(seasonal)
Sys.setenv(X13_PATH = normalizePath(system.file("bin", package = "x13binary"), winslash = "/"))
seas(AirPassengers)

Solution

Wrap x13.bin in normalizPath and change seas.R:551 to:

if (getOption("htmlmode") == 1){
  x13.bin <- paste0("\"", normalizePath(file.path(env.path, "x13ashtml.exe")), "\"")
} else {
  x13.bin <- paste0("\"", normalizePath(file.path(env.path, "x13as.exe")), "\"")
}
@christophsax
Copy link
Owner Author

Original output

> library(seasonal)
> broken <- "\\\\szh.loc/soz/users/sozrcb/Dokumente/R/win-library/3.5/x13binary/bin/x13ashtml.exe"
> broken
[1] "\\\\szh.loc/soz/users/sozrcb/Dokumente/R/win-library/3.5/x13binary/bin/x13ashtml.exe"
> fixed <- normalizePath(broken, mustWork = TRUE)
> fixed
[1] "\\\\szh.loc\\soz\\users\\sozrcb\\Dokumente\\R\\win-library\\3.5\\x13binary\\bin\\x13ashtml.exe"
>
> shell(paste0('"', broken,'"'))
"\\szh.loc\soz\users\sozrcb\Dokumente"
CMD.EXE wurde mit dem oben angegebenen Pfad als aktuellem Verzeichnis gestartet.
UNC-Pfade werden nicht unterst�tzt.
Stattdessen wird das Windows-Verzeichnis als aktuelles Verzeichnis gesetzt.
Die Syntax f�r den Dateinamen, Verzeichnisnamen oder die Datentr„gerbezeichnung ist falsch.
Warning message:
In shell(paste0("\"", broken, "\"")) :
  '"\\szh.loc/soz/users/sozrcb/Dokumente/R/win-library/3.5/x13binary/bin/x13ashtml.exe"' Ausführung mit Fehlerkode 1 fehlgeschlagen
> shell(paste0('"', fixed, '"'))
"\\szh.loc\soz\users\sozrcb\Dokumente"
CMD.EXE wurde mit dem oben angegebenen Pfad als aktuellem Verzeichnis gestartet.
UNC-Pfade werden nicht unterst�tzt.
Stattdessen wird das Windows-Verzeichnis als aktuelles Verzeichnis gesetzt.
 
X-13ARIMA-SEATS Seasonal Adjustment Program
Version Number 1.1 Build 39
Execution began  Nov 26, 2019  08.32.21

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant