Skip to content

Commit 84da0be

Browse files
committed
fixes rstudio#306: remove the possible trailing slash under Windows
the cause: normalize('foo', '/') => C:/foo normalize('foo/', '/') => C:/foo/ under Windows. For unix, the trailing slash will always be removed in normalizePath()
1 parent 267751c commit 84da0be

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,9 @@ shiny 0.8.0.99
126126
e.g. the label in sliderInput(..., label = HTML('<em>A Label</em>')) will
127127
not be escaped any more. (#119)
128128

129+
* Fixed #306: the trailing slash in a path could fail `addResourcePath()`
130+
under Windows. (Thanks, ZJ Dai)
131+
129132
shiny 0.8.0
130133
--------------------------------------------------------------------------------
131134

R/shiny.R

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -674,6 +674,8 @@ resolve <- function(dir, relpath) {
674674
return(NULL)
675675
abs.path <- normalizePath(abs.path, winslash='/', mustWork=TRUE)
676676
dir <- normalizePath(dir, winslash='/', mustWork=TRUE)
677+
# trim the possible trailing slash under Windows (#306)
678+
if (.Platform$OS.type == 'windows') dir <- sub('/$', '', dir)
677679
if (nchar(abs.path) <= nchar(dir) + 1)
678680
return(NULL)
679681
if (substr(abs.path, 1, nchar(dir)) != dir ||

0 commit comments

Comments
 (0)