Skip to content

Commit 1cccc4b

Browse files
committed
Fix temporary file names on Windows
1 parent c3c8918 commit 1cccc4b

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

spec/meta_spec.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
local vips = require "vips"
2+
local ffi = require "ffi"
23

34
-- test metadata read/write
45
describe("metadata", function()
56
local array, im
6-
local tmp_vips_filename = "/tmp/x.v"
7+
local tmp_vips_filename = ffi.os == "Windows" and os.getenv("TMP") .. "\\x.v" or "/tmp/x.v"
78

89
setup(function()
910
array = { 1, 2, 3, 4 }

spec/write_spec.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ describe("test image write", function()
1111
describe("to file", function()
1212
local array = { 1, 2, 3, 4 }
1313
local im = vips.Image.new_from_array(array)
14-
local tmp_png_filename = "/tmp/x.png"
15-
local tmp_jpg_filename = "/tmp/x.jpg"
14+
local tmp_png_filename = ffi.os == "Windows" and os.getenv("TMP") .. "\\x.png" or "/tmp/x.png"
15+
local tmp_jpg_filename = ffi.os == "Windows" and os.getenv("TMP") .. "\\x.jpg" or "/tmp/x.jpg"
1616

1717
teardown(function()
1818
os.remove(tmp_png_filename)

0 commit comments

Comments
 (0)