hafen / trelliscopejs
1
# The following code was taken directly from the {xfun} package. It is
2
# licensed under the MIT license. The copyright holder is Yihui Xie.
3
# See https://github.com/yihui/xfun for the package and details.
4

5
is_abs_path <- function (x) {
6 0
    if (is_unix())
7 0
        grepl("^[/~]", x)
8 0
    else !same_path(x, file.path(".", x))
9
}
10

11
same_path <- function (p1, p2, ...) {
12 0
    normalize_path(p1, ...) == normalize_path(p2, ...)
13
}
14

15
normalize_path <- function (x, winslash = "/", must_work = FALSE) {
16 0
    res = normalizePath(x, winslash = winslash, mustWork = must_work)
17 0
    if (is_windows())
18 0
        res[is.na(x)] = NA
19 0
    res
20
}
21

22
is_windows <- function () {
23 0
  .Platform$OS.type == "windows"
24
}
25

26
is_unix <- function () {
27 0
  .Platform$OS.type == "unix"
28
}

Read our documentation on viewing source code .

Loading