Comments (15)
Yes indeed it should. I must have busted that when generalizing for git(hub) use. We need to look at srcdir
and repodir
-- do you have a few spare cycles to look at it?
from drat.
I'll give it a try; my inner perl hacker (ugh) says to rewrite
file.copy(file.path(curwd, file), srcdir, overwrite=TRUE)
as
file.copy(file.path(curwd, file), srcdir, overwrite=TRUE) || file.copy(file, srcdir, overwrite=TRUE)
from drat.
oh, and maybe wrap that all with stopifnot
.
from drat.
I'd pre-test with
if (!file.exists(file)) { whine() }
etc
from drat.
There is already a check for the file at the head of the function.
from drat.
It's not quite right.
stopifnot(file.copy(file.path(curwd, file), srcdir, overwrite=TRUE) ||
file.copy(file, srcdir, overwrite=TRUE))
If we are in curwd, then both branches are equivalent, so this does not yet help enough. I'll look at it some more on the train home in a few hours.
from drat.
It might help if you convert the path to absolute in the first place. E.g.
absolute_path <- function(path) {
path <- path.expand(path)
if (substr(path, 1, 1) == "/") {
path
} else {
file.path(getwd(), path)
}
}
Btw. why can't you just say file.copy(file, srcdir, ...
)? I haven't read the complete code, so maybe this is not an option.
from drat.
Nice idea, thanks.
It should actually be pretty simple. file.copy()
surely takes anything, absolute or relative, but I need a partial path later in the (optional) git2r::add()
call, and that is where I went off the road prior to 0.0.2.
from drat.
The file.copy(file.path(curwd, file), srcdir)
is wrong, and it arose because of the optional setwd()
earlier.
from drat.
I'm not sure both "both branches are equivalent":
> file.path(getwd(),'/tmp/foobar.tar.gz')
[1] "/home/spav//tmp/foobar.tar.gz"
but you're right, I forget to fix the git2r::add
.
from drat.
The stopifnot( ... || ...)
is still weird, and I don't like it. We are in curwd
, so both are the same. At the most, use explicit tests and stop()
calls.
The basename()
looks good.
from drat.
Ack re your comment of both branches being different. The problem was the thinko related to the earlier setwd()
. At that point all we need is file.copy(file, dir)
having tested that both file
and dir
exist.
from drat.
This may actually be much less scary than we thought. Can you look at what I just committed? Either via checkout, or by simply pulling the relevant file as is ?
from drat.
LGTM for absolute paths.
Should there be a catch on file.copy
returning `FALSE`` (e.g. due to permissions issues)?
from drat.
Great, and a) sorry for the earlier runaround and b) yes that is a very good idea. Help page suggest that a boolean is returned to lemme add that.
from drat.
Related Issues (20)
- Add new draft vignette on 'step-by-step' demo of `drat` HOT 1
- Convert other vignettes to `minidown::water` HOT 1
- install.packages("drat") fails: `Error : object 'update_PACKAGES' is not exported by 'namespace:tools'` HOT 5
- Problem with link checker in r-devel HOT 3
- Nearing drat 0.2.0 release with main branch docs/ directory support HOT 1
- drat 0.2.0: breaking change if `dratBranch = "main"` HOT 8
- missing getPackageInfo in 0.2.0 HOT 7
- Importing and using large data R package HOT 2
- Insert binary packages to wrong repository on ARM M1 Mac HOT 25
- insertPackage is very slow when using networked windows devices HOT 7
- insertPackage is slow for cloud-based file shares HOT 3
- sorry HOT 1
- Can old package versions be removed from drat folder? HOT 6
- pruneRepo fails with for package type mac.binary.big-sur-arm64 HOT 1
- minor typo HOT 3
- Broken link in doc ? HOT 3
- Possible discrepancy between where drat and CRAN places binaries when .Platform$pkgType is "mac.binary.big-sur-x86_64" HOT 14
- drat 0.2.4 release HOT 1
- [windows] Create repository using local server HOT 8
- installing package p2data HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from drat.