Skip to content

Commit

Permalink
fix issue ramnathv#53 for non-windows with scaffold
Browse files Browse the repository at this point in the history
  • Loading branch information
timelyportfolio committed Dec 24, 2014
1 parent 782a360 commit 268a9a6
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions R/scaffold.R
Original file line number Diff line number Diff line change
Expand Up @@ -185,15 +185,16 @@ installBowerPkg <- function(pkg){
findBower <- function(){
# a slightly more robust finder of bower for windows
# which does not require PATH environment variable to be set
bowerPath = if(Sys.which("bower") == "") {

# try to find the easy case
bowerPath = Sys.which("bower")

if(bowerPath == "" && identical(.Platform$OS.type,"windows")) {
# if it does not find Sys.which('bower')
# also check APPDATA to see if found there
if(identical(.Platform$OS.type,"windows")) {
Sys.which(file.path(Sys.getenv("APPDATA"),"npm","bower."))
}
} else {
Sys.which("bower")
# also check APPDATA if Windows to see if found there
bowerPath = Sys.which(file.path(Sys.getenv("APPDATA"),"npm","bower."))
}

return(bowerPath)
}

Expand Down

1 comment on commit 268a9a6

@timelyportfolio
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went with this option since

is_bower_installed <- function(){
   ...
)

seemed redundant in that the check to see if installed would duplicate steps then required to find the path if is_bower_installed() == T. Happy to do the other way if better coding practice though.

Please sign in to comment.