datalorax/slidex

Access is denied on Windows

Opened this issue · 9 comments

thanks for the awesome package! here is the reprex:

library(slidex)
pptx <- system.file("examples", "slidedemo.pptx", package = "slidex")
convert_pptx(path = pptx, author = "Daniel Anderson")
#> Warning in file.rename(file.path(basepath, "xml", "ppt",
#> "media"), file.path(basepath, : cannot rename file 'C:
#> \Users\timing\AppData\Local\Temp\Rtmpc1hPjj/slidedemo/xml/ppt/media' to 'C:
#> \Users\timing\AppData\Local\Temp\Rtmpc1hPjj/slidedemo/assets/img', reason
#> 'Access is denied'
#> Warning in file.rename(file.path(basepath, "xml", "ppt", "embeddings"), : cannot
#> rename file 'C:\Users\timing\AppData\Local\Temp\Rtmpc1hPjj/slidedemo/xml/ppt/
#> embeddings' to 'C:\Users\timing\AppData\Local\Temp\Rtmpc1hPjj/slidedemo/assets/
#> data', reason 'Access is denied'
#> Warning in system(paste(Sys.getenv("R_BROWSER"), file.path(out_dir, gsub("\
#> \.Rmd", : 'false' not found
#> [1] 127

Created on 2021-03-16 by the reprex package (v1.0.0)

Session info
sessioninfo::session_info()
#> - Session info ---------------------------------------------------------------
#>  setting  value                       
#>  version  R version 4.0.3 (2020-10-10)
#>  os       Windows 10 x64              
#>  system   x86_64, mingw32             
#>  ui       RTerm                       
#>  language (EN)                        
#>  collate  English_United Kingdom.1252 
#>  ctype    English_United Kingdom.1252 
#>  tz       Europe/London               
#>  date     2021-03-16                  
#> 
#> - Packages -------------------------------------------------------------------
#>  package     * version    date       lib source                            
#>  assertthat    0.2.1      2019-03-21 [1] CRAN (R 4.0.2)                    
#>  backports     1.1.10     2020-09-15 [1] CRAN (R 4.0.2)                    
#>  blob          1.2.1      2020-01-20 [1] CRAN (R 4.0.2)                    
#>  cli           2.3.0      2021-01-31 [1] CRAN (R 4.0.3)                    
#>  crayon        1.4.1      2021-02-08 [1] CRAN (R 4.0.3)                    
#>  DBI           1.1.0      2019-12-15 [1] CRAN (R 4.0.2)                    
#>  digest        0.6.27     2020-10-24 [1] CRAN (R 4.0.3)                    
#>  dplyr         1.0.4      2021-02-02 [1] CRAN (R 4.0.3)                    
#>  ellipsis      0.3.1      2020-05-15 [1] CRAN (R 4.0.2)                    
#>  evaluate      0.14       2019-05-28 [1] CRAN (R 4.0.2)                    
#>  fs            1.5.0      2020-07-31 [1] CRAN (R 4.0.2)                    
#>  generics      0.1.0      2020-10-31 [1] CRAN (R 4.0.3)                    
#>  glue          1.4.2      2020-08-27 [1] CRAN (R 4.0.2)                    
#>  highr         0.8        2019-03-20 [1] CRAN (R 4.0.2)                    
#>  htmltools     0.5.1.1    2021-01-22 [1] CRAN (R 4.0.3)                    
#>  knitr         1.31       2021-01-27 [1] CRAN (R 4.0.3)                    
#>  lifecycle     0.2.0      2020-03-06 [1] CRAN (R 4.0.2)                    
#>  magrittr      2.0.1      2020-11-17 [1] CRAN (R 4.0.3)                    
#>  pillar        1.4.7      2020-11-20 [1] CRAN (R 4.0.3)                    
#>  pkgconfig     2.0.3      2019-09-22 [1] CRAN (R 4.0.2)                    
#>  purrr         0.3.4      2020-04-17 [1] CRAN (R 4.0.2)                    
#>  R6            2.5.0      2020-10-28 [1] CRAN (R 4.0.3)                    
#>  reprex        1.0.0      2021-01-27 [1] CRAN (R 4.0.4)                    
#>  rlang         0.4.10     2020-12-30 [1] CRAN (R 4.0.3)                    
#>  rmarkdown     2.6.6      2021-02-12 [1] Github (rstudio/rmarkdown@a62cb20)
#>  sessioninfo   1.1.1      2018-11-05 [1] CRAN (R 4.0.3)                    
#>  slidex      * 0.0.0.9001 2021-02-12 [1] Github (datalorax/slidex@1c282ee) 
#>  stringi       1.5.3      2020-09-09 [1] CRAN (R 4.0.2)                    
#>  stringr       1.4.0      2019-02-10 [1] CRAN (R 4.0.2)                    
#>  styler        1.3.2      2020-02-23 [1] CRAN (R 4.0.3)                    
#>  tibble        3.0.6      2021-01-29 [1] CRAN (R 4.0.3)                    
#>  tidyr         1.1.2      2020-08-27 [1] CRAN (R 4.0.2)                    
#>  tidyselect    1.1.0      2020-05-11 [1] CRAN (R 4.0.2)                    
#>  vctrs         0.3.6      2020-12-17 [1] CRAN (R 4.0.3)                    
#>  withr         2.3.0      2020-09-22 [1] CRAN (R 4.0.2)                    
#>  xfun          0.20       2021-01-06 [1] CRAN (R 4.0.3)                    
#>  xml2          1.3.2      2020-04-23 [1] CRAN (R 4.0.3)                    
#>  yaml          2.2.1      2020-02-01 [1] CRAN (R 4.0.2)                    
#> 
#> [1] C:/Users/timing/Documents/R/win-library/4.0
#> [2] C:/Program Files/R/R-4.0.3/library

Hi - unfortunately I'm not really sure how to help here. It sounds like a permissions issue for your local machine. I also do not have access to a Windows machine, unfortunately.

This "access is denied" error in the "rename" (seems like a file copy) seems to be a consequence of a known Windows restriction.

"In other words as long as the directory itself or any file or subdirectory in this directory or its subdirectories is in use by any application, Windows denies renaming or deleting the directory.

On Unix/Linux it is possible to delete or rename a directory while it is in use by 1 or more running processes."
[from https://stackoverflow.com/questions/41365318/access-is-denied-when-renaming-folder]

I tried the potential Quick Access solution on that webpage and it also failed.

@datalorax, can you assign this to me? I am working on it. I solved the "access is denied" problem although I asked on Stack Overflow and in R Studio Community how I might do so more elegantly. I also hit an error that required the following in checks.R
if(length(lang) == 0) return()

Stack Overflow ref. : https://stackoverflow.com/questions/68328641/copying-files-with-r-package-in-windows-access-is-denied-file-path
R Studio Comm ref.: https://community.rstudio.com/t/copying-files-with-r-package-on-windows-access-is-denied-file-path/109695

I'll commit later

Crud: The images did not copy to the right place with my solution. I am also seeing some formatting problems - a lack of proper conversion of quotation marks and ã are more predictable, but the lack of carriage returns could mean something deeper.

@liutiming , can you provide what your package outputs for you when it processes this Powerpoint I presented at useR!2021 about Ben Ubah's https://r-community.org? That will help me decide what I need to fix in the Windows updates.

Hi @RickPack, sure thing. Just did that. Also, as you have probably noticed I have not really maintained this package in a while. If you'd have interest in taking over as a maintainer I'd be more than happy to discuss that. No pressure whatsoever, just an open invitation.

Thanks, @datalorax. Have you written anything anywhere about how the package works? I think it would be too much for me to learn enough to serve as a maintainer at this time.

I did, actually. There's a blog post about it here. I'd be happy to help with the transition too. But again, no pressure. Totally understand if you'd rather not.