Skip to content

Commit

Permalink
Fix for non-standard Rtools installation paths.
Browse files Browse the repository at this point in the history
  • Loading branch information
sjmgarnier committed Jan 8, 2024
1 parent 589c97c commit 5d00a06
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 30 deletions.
3 changes: 0 additions & 3 deletions CRAN-SUBMISSION

This file was deleted.

8 changes: 6 additions & 2 deletions R/install.R
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ defaultOpenCVPath <- function() {
config$source_dir <- paste0(config$tmp_dir, "\\opencv-", version, "\\")
config$contrib_dir <- paste0(config$tmp_dir, "\\opencv_contrib-", version, "\\modules")
config$build_dir <- paste0(config$source_dir, "build")

ix <- grepl("path", names(config)) | grepl("dir", names(config))
config[ix] <- lapply(config[ix], function(st) gsub("\\\\", "/", utils::shortPathName(st)))
} else if (config$os_type == "unix") {
config$install_path <- install_path
config$pkg_path <- find.package("ROpenCVLite")
Expand All @@ -86,12 +89,13 @@ defaultOpenCVPath <- function() {
config$source_dir <- paste0(config$tmp_dir, "/opencv-", version, "/")
config$contrib_dir <- paste0(config$tmp_dir, "/opencv_contrib-", version, "/modules")
config$build_dir <- paste0(config$source_dir, "build")

ix <- grepl("path", names(config)) | grepl("dir", names(config))
config[ix] <- lapply(config[ix], normalizePath, mustWork = FALSE, winslash = "/")
} else {
stop("Unsupported OS type.")
}

ix <- grepl("path", names(config)) | grepl("dir", names(config))
config[ix] <- lapply(config[ix], normalizePath, mustWork = FALSE, winslash = "/")
config
}

Expand Down
19 changes: 10 additions & 9 deletions docs/articles/install.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions docs/pkgdown.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
pandoc: 3.1.11
pandoc: 3.1.11.1
pkgdown: 2.0.7
pkgdown_sha: ~
articles:
install: install.html
usage: usage.html
last_built: 2023-12-31T07:35Z
last_built: 2024-01-08T13:09Z
urls:
reference: https://swarm-lab.github.io/ROpenCVLite/reference
article: https://swarm-lab.github.io/ROpenCVLite/articles
Expand Down
10 changes: 5 additions & 5 deletions vignettes/install.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ with `Rtools42` and `Rtools43`.
If you have the [`rig`](https://github.com/r-lib/rig) utility installed on your
computer, you can install `Rtools` from a terminal running PowerShell:

```{powershell eval=FALSE}
```{bash eval=FALSE}
# For Rtools40
rig add rtools40
Expand All @@ -84,7 +84,7 @@ If you have the [`winget`](https://learn.microsoft.com/en-us/windows/package-man
utility installed on your computer, you can install `Rtools` from a terminal
running PowerShell:

```{powershell eval=FALSE}
```{bash eval=FALSE}
winget install RProject.Rtools
```

Expand All @@ -110,7 +110,7 @@ install `Cmake` on Windows:

##### **Option 1**

Use the convenience function provided by the `installr` library:
Use the convenience function provided by the `installr` library:

```{r eval=FALSE}
if (!require("installr"))
Expand All @@ -128,13 +128,13 @@ If you have the [`winget`](https://learn.microsoft.com/en-us/windows/package-man
utility installed on your computer, you can install `Cmake` from a terminal
running PowerShell:

```{powershell eval=FALSE}
```{bash eval=FALSE}
winget install cmake
```

##### **Option 3**

You can manually download the CMake` installer for Windows at
You can manually download the `CMake` installer for Windows at
[https://cmake.org/download/](https://cmake.org/download/). Make sure to tell
the installer to add `CMake` to your "PATH" during the installation process.

Expand Down
19 changes: 10 additions & 9 deletions vignettes/install.html
Original file line number Diff line number Diff line change
Expand Up @@ -404,21 +404,21 @@ <h5><strong>Option 2</strong></h5>
<p>If you have the <a href="https://github.com/r-lib/rig"><code>rig</code></a> utility
installed on your computer, you can install <code>Rtools</code> from a
terminal running PowerShell:</p>
<div class="sourceCode" id="cb2"><pre class="sourceCode powershell"><code class="sourceCode powershell"><span id="cb2-1"><a href="#cb2-1" tabindex="-1"></a><span class="co"># For Rtools40</span></span>
<span id="cb2-2"><a href="#cb2-2" tabindex="-1"></a>rig add rtools40</span>
<div class="sourceCode" id="cb2"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb2-1"><a href="#cb2-1" tabindex="-1"></a><span class="co"># For Rtools40</span></span>
<span id="cb2-2"><a href="#cb2-2" tabindex="-1"></a><span class="ex">rig</span> add rtools40</span>
<span id="cb2-3"><a href="#cb2-3" tabindex="-1"></a></span>
<span id="cb2-4"><a href="#cb2-4" tabindex="-1"></a><span class="co"># For Rtools42</span></span>
<span id="cb2-5"><a href="#cb2-5" tabindex="-1"></a>rig add rtools42</span>
<span id="cb2-5"><a href="#cb2-5" tabindex="-1"></a><span class="ex">rig</span> add rtools42</span>
<span id="cb2-6"><a href="#cb2-6" tabindex="-1"></a></span>
<span id="cb2-7"><a href="#cb2-7" tabindex="-1"></a><span class="co"># For Rtools43</span></span>
<span id="cb2-8"><a href="#cb2-8" tabindex="-1"></a>rig add rtools43</span></code></pre></div>
<span id="cb2-8"><a href="#cb2-8" tabindex="-1"></a><span class="ex">rig</span> add rtools43</span></code></pre></div>
</div>
<div id="option-3" class="section level5">
<h5><strong>Option 3</strong></h5>
<p>If you have the <a href="https://learn.microsoft.com/en-us/windows/package-manager/"><code>winget</code></a>
utility installed on your computer, you can install <code>Rtools</code>
from a terminal running PowerShell:</p>
<div class="sourceCode" id="cb3"><pre class="sourceCode powershell"><code class="sourceCode powershell"><span id="cb3-1"><a href="#cb3-1" tabindex="-1"></a>winget install RProject<span class="op">.</span><span class="fu">Rtools</span></span></code></pre></div>
<div class="sourceCode" id="cb3"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" tabindex="-1"></a><span class="ex">winget</span> install RProject.Rtools</span></code></pre></div>
<p><em>Note:</em> Only <code>Rtools42</code> seems to be available
through <code>winget</code> at the moment.</p>
</div>
Expand Down Expand Up @@ -456,13 +456,14 @@ <h5><strong>Option 2</strong></h5>
<p>If you have the <a href="https://learn.microsoft.com/en-us/windows/package-manager/"><code>winget</code></a>
utility installed on your computer, you can install <code>Cmake</code>
from a terminal running PowerShell:</p>
<div class="sourceCode" id="cb5"><pre class="sourceCode powershell"><code class="sourceCode powershell"><span id="cb5-1"><a href="#cb5-1" tabindex="-1"></a>winget install cmake</span></code></pre></div>
<div class="sourceCode" id="cb5"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb5-1"><a href="#cb5-1" tabindex="-1"></a><span class="ex">winget</span> install cmake</span></code></pre></div>
</div>
<div id="option-3-1" class="section level5">
<h5><strong>Option 3</strong></h5>
<p>You can manually download the
CMake<code>installer for Windows at [https://cmake.org/download/](https://cmake.org/download/). Make sure to tell the installer to add</code>CMake`
to your “PATH” during the installation process.</p>
<p>You can manually download the <code>CMake</code> installer for
Windows at <a href="https://cmake.org/download/">https://cmake.org/download/</a>. Make
sure to tell the installer to add <code>CMake</code> to your “PATH”
during the installation process.</p>
<hr />
</div>
</div>
Expand Down

0 comments on commit 5d00a06

Please sign in to comment.