## testing bringme on diff machines.r


setScience("z Test Project", create=TRUE, quiet=TRUE, subl=FALSE)
.us()

f1 <- out.p("test file 01 - local.txt")
f2 <- out.p("test file 02 - remote.txt")
f3 <- out.p("test file 02 - DUPLICATE FILE.txt")

if (.Pfm == "Linux") {
  write(x="This is a test for file 02 - remote"      , file=f2)
  write(x="This is from remote\nThis is from remote" , file=f3)

} else {
  write(x="This is a test for file 01 - local"       , file=f1)
  write(x="This is from local\nThis is from local"   , file=f3)
}

.w()
outDir %>% dir %>% cbind %T>% {colnames(.) <- "FILES IN outDir"} %>% print

if (FALSE) {
  ## on local
  this_file <- '~/git/orch/src/misc/testing bringme on diff machines.r'
  source(this_file)

  ## on linux
  this_file <- '~/git/orch/src/misc/testing bringme on diff machines.r'
  source(this_file)

  ## on linux
  bringme(f2, rsync=TRUE) ## ERROR


  ## on local
  if (.Pfm != "Linux") {
    bringme(f1, rsync=TRUE) %>% print ## ERROR
    bringme(f2, rsync=TRUE) %>% print ## Should work

    cat("\n\nBefore attempting to bring f3, its content is ", pasteR(30), readLines(f3), pasteR(30), sep="\n")
    bringme(f3, rsync=TRUE) %>% print ## ???
    cat("\n\nAfter attempting to bring f3, its content is ", pasteR(30), readLines(f3), pasteR(30), sep="\n")

    subl(f3)

  }

}
