Skip to content

Commit

Permalink
Add support for .tgz files
Browse files Browse the repository at this point in the history
Closes #17
  • Loading branch information
chamburr committed Jun 1, 2022
1 parent c59490b commit ef5afda
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions QLPlugin/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
<string>com.sun.web-application-archive</string> <!-- .war (Java) -->
<string>dyn.ah62d4rv4ge80n2pw</string> <!-- .ear (Java) -->
<string>org.gnu.gnu-zip-archive</string> <!-- .gz -->
<string>org.gnu.gnu-zip-tar-archive</string> <!-- .tgz -->
<string>public.tar-archive</string> <!-- .tar -->
<string>public.zip-archive</string> <!-- .zip -->

Expand Down
2 changes: 1 addition & 1 deletion QLPlugin/Utils/File.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ extension FileError: LocalizedError {

/// Utility class for reading the content and metadata of the corresponding file.
class File {
let archiveExtensions = ["tar", "tar.gz", "zip"]
let archiveExtensions = ["tar", "tar.gz", "tgz", "zip"]
let fileManager = FileManager.default

var attributes: [FileAttributeKey: Any]
Expand Down
2 changes: 1 addition & 1 deletion QLPlugin/Views/PreviewVCFactory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class PreviewVCFactory {
return MarkdownPreview.self
case "ipynb":
return JupyterPreview.self
case "tar":
case "tar", "tgz":
return TARPreview.self
case "tab", "tsv":
return TSVPreview.self
Expand Down
2 changes: 1 addition & 1 deletion QLPlugin/Views/Previews/TARPreview.swift
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ class TARPreview: Preview {
}

func createPreviewVC(file: File) throws -> PreviewVC {
let isGzipped = file.path.hasSuffix(".tar.gz")
let isGzipped = file.path.hasSuffix(".tar.gz") || file.path.hasSuffix(".tgz")

// Parse TAR contents
let filesOutput = try runTARFilesCommand(filePath: file.path)
Expand Down

0 comments on commit ef5afda

Please sign in to comment.