@@ -7551,9 +7551,24 @@ add_dummies <- function(dir, Log)
75517551            if  (thispkg_subdirs  ==  " default" thispkg_subdirs  <-  " no" 
75527552        } else  if  (file.exists(pkg )) {
75537553            is_tar  <-  TRUE 
7554-             if  (thispkg_subdirs  ==  " default" thispkg_subdirs  <-  " yes-maybe" 
7555-             pkgname0  <-  sub(" \\ .(tar|tar\\ .gz|tgz|tar\\ .bz2|tar\\ .xz|tar\\ .zstd)$" " " pkgname0 )
7556-             pkgname0  <-  sub(" _[0-9.-]*$" " " pkgname0 )
7554+             # # if (thispkg_subdirs == "default") thispkg_subdirs <- "yes-maybe"
7555+             # # pkgname0 <- sub("\\.(tar|tar\\.gz|tgz|tar\\.bz2|tar\\.xz|tar\\.zstd)$", "", pkgname0)
7556+             # # pkgname0 <- sub("_[0-9.-]*$", "", pkgname0)
7557+             # # look at the contents to find the package name
7558+             contents  <-  try(
7559+                 utils :: untar(pkg , list  =  TRUE ,
7560+                              tar  =  Sys.getenv(" R_INSTALL_TAR" " internal" 
7561+             if (inherits(contents , " try-error" 
7562+                 warning(sQuote(pkg ), "  is neither a tarball nor a directory, skipping\n " 
7563+                         domain  =  NA , call.  =  FALSE , immediate.  =  TRUE )
7564+                 next 
7565+             }
7566+             if  (length(contents ) <  1  ||  ! endsWith(contents [1 ], " /" 
7567+               warning(sQuote(pkg ), "  does not contain a directory, skipping\n " 
7568+                       domain  =  NA , call.  =  FALSE , immediate.  =  TRUE )
7569+               next 
7570+             }
7571+             pkgname0  <-  sub(" /$" " " contents [1 ])
75577572        } else  {
75587573            warning(sQuote(pkg ), "  is neither a file nor directory, skipping\n " 
75597574                    domain  =  NA , call.  =  FALSE , immediate.  =  TRUE )
0 commit comments