Skip to content

Commit

Permalink
don't try double-quotes on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
mceachen committed Sep 20, 2020
1 parent 6068dee commit 7bce053
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
8 changes: 3 additions & 5 deletions src/ExifTool.spec.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import { BatchCluster } from "batch-cluster"
import * as _path from "path"
import { platform } from "process"

import { expect, testImg } from "./_chai.spec"
import { times } from "./Array"
import { ExifDateTime } from "./ExifDateTime"
import { DefaultMaxProcs, ExifTool, exiftool } from "./ExifTool"
import { keys } from "./Object"
import { Tags } from "./Tags"
import { leftPad } from "./String"
import { Tags } from "./Tags"
import { expect, isWin32, testImg } from "./_chai.spec"

function normalize(tagNames: string[]): string[] {
return tagNames
Expand Down Expand Up @@ -68,7 +66,7 @@ describe("ExifTool", function () {
ignoreShebangs.push(true)
} else {
ignoreShebangs.push(false)
if (platform !== "win32") ignoreShebangs.push(true)
if (!isWin32()) ignoreShebangs.push(true)
}

for (const ignoreShebang of ignoreShebangs) {
Expand Down
4 changes: 2 additions & 2 deletions src/ReadTask.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { ExifDateTime } from "./ExifDateTime"
import { exiftool, ExifTool } from "./ExifTool"
import { ReadTask } from "./ReadTask"
import { Tags } from "./Tags"
import { expect } from "./_chai.spec"
import { expect, isWin32 } from "./_chai.spec"

function parse(tags: any, err?: Error): Tags {
const tt = ReadTask.for("/tmp/example.jpg", [])
Expand Down Expand Up @@ -262,7 +262,7 @@ describe("ReadTask", () => {

describe("quotes in filenames", () => {
after(() => exiftool.end())
const base = `it's a "file".jpg`
const base = isWin32() ? `it's a file.jpg` : `it's a "file".jpg`
it("reads from " + base, async () => {
const tmp = join(tmpdir(), base)
await fse.mkdirp(tmpdir())
Expand Down
6 changes: 5 additions & 1 deletion src/_chai.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Deferred, Logger, setLogger } from "batch-cluster"
import { createHash } from "crypto"
import * as fse from "fs-extra"
import { tmpdir } from "os"
import { platform, tmpdir } from "os"
import { join } from "path"
import { env } from "process"
import { orElse } from "./Maybe"
Expand Down Expand Up @@ -64,3 +64,7 @@ export function sha1(path: string): Promise<string> {
readStream.on("end", () => d.resolve(sha.digest().toString("hex")))
return d.promise
}

export function isWin32() {
return platform() === "win32"
}

0 comments on commit 7bce053

Please sign in to comment.