From 233fafe84392b967616de1c0d4c05da1e52532ec Mon Sep 17 00:00:00 2001 From: develar Date: Sat, 2 Jul 2016 19:58:25 +0200 Subject: [PATCH] fix: non-English characters confuse rcedit: Unable to load file on windows build (from linux) Closes #384 --- .idea/dictionaries/develar.xml | 1 + package.json | 12 ++++++------ test/fixtures/test-app-one/package.json | 2 +- test/src/helpers/packTester.ts | 21 ++++++++++++--------- test/src/macPackagerTest.ts | 8 ++++---- test/tsconfig.json | 2 +- tsconfig.json | 2 +- 7 files changed, 26 insertions(+), 22 deletions(-) diff --git a/.idea/dictionaries/develar.xml b/.idea/dictionaries/develar.xml index fcd5d9cf32f..63aed6f8c70 100644 --- a/.idea/dictionaries/develar.xml +++ b/.idea/dictionaries/develar.xml @@ -31,6 +31,7 @@ globby gnubin graphicsmagick + grün gtar guid headerimage diff --git a/package.json b/package.json index 44d140ff0bd..86ae0b00821 100644 --- a/package.json +++ b/package.json @@ -67,8 +67,8 @@ "debug": "^2.2.0", "deep-assign": "^2.0.0", "electron-osx-sign-tf": "0.6.0", - "electron-packager-tf": "~7.5.1", - "electron-winstaller-fixed": "~2.11.5", + "electron-packager-tf": "~7.5.2", + "electron-winstaller-fixed": "~2.11.6", "fs-extra-p": "^1.0.5", "hosted-git-info": "^2.1.5", "image-size": "^0.5.0", @@ -102,10 +102,10 @@ }, "devDependencies": { "@types/debug": "0.0.22-alpha", - "@types/mime": "0.0.22-alpha", - "@types/progress": "^1.1.21-alpha", - "@types/semver": "^4.3.20-alpha", - "@types/source-map-support": "^0.2.21-alpha", + "@types/mime": "0.0.25-alpha", + "@types/progress": "^1.1.24-alpha", + "@types/semver": "^4.3.23-alpha", + "@types/source-map-support": "^0.2.24-alpha", "ava-tf": "^0.15.3", "babel-plugin-array-includes": "^2.0.3", "babel-plugin-transform-es2015-destructuring": "^6.9.0", diff --git a/test/fixtures/test-app-one/package.json b/test/fixtures/test-app-one/package.json index 8d5d5021432..dd960a3038e 100755 --- a/test/fixtures/test-app-one/package.json +++ b/test/fixtures/test-app-one/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "TestApp", - "productName": "Test App A/B", + "productName": "Test App ß/W", "version": "1.1.0", "homepage": "http://foo.example.com", "description": "Test Application (test quite \" #378)", diff --git a/test/src/helpers/packTester.ts b/test/src/helpers/packTester.ts index d73972ff5ce..39e83fa6be1 100755 --- a/test/src/helpers/packTester.ts +++ b/test/src/helpers/packTester.ts @@ -144,7 +144,7 @@ async function checkLinuxResult(projectDir: string, packager: Packager, checkOpt } const productFilename = packager.appInfo.productFilename - const expectedContents = expectedLinuxContents.map(it => { + const expectedContents = pathSorter(expectedLinuxContents.map(it => { if (it === "/opt/TestApp/TestApp") { return "/opt/" + productFilename + "/" + productFilename } @@ -154,15 +154,15 @@ async function checkLinuxResult(projectDir: string, packager: Packager, checkOpt else { return it.replace(new RegExp("/opt/TestApp/", "g"), `/opt/${productFilename}/`) } - }) + })) // console.log(JSON.stringify(await getContents(projectDir + "/dist/TestApp-1.0.0-amd64.deb", productName), null, 2)) // console.log(JSON.stringify(await getContents(projectDir + "/dist/TestApp-1.0.0-i386.deb", productName), null, 2)) const packageFile = `${projectDir}/${outDirName}/TestApp-${packager.appInfo.version}.deb` - assertThat(await getContents(packageFile, productFilename)).isEqualTo(expectedContents) + assertThat(await getContents(packageFile)).isEqualTo(expectedContents) if (arch === Arch.ia32) { - assertThat(await getContents(`${projectDir}/${outDirName}/TestApp-${packager.appInfo.version}-i386.deb`, productFilename)).isEqualTo(expectedContents) + assertThat(await getContents(`${projectDir}/${outDirName}/TestApp-${packager.appInfo.version}-i386.deb`)).isEqualTo(expectedContents) } assertThat2(parseDebControl(await exec("dpkg", ["--info", packageFile]))).has.properties({ @@ -277,14 +277,17 @@ async function checkWindowsResult(packager: Packager, checkOptions: AssertPackOp // console.log(JSON.stringify(files, null, 2)) const expectedContents = checkOptions == null || checkOptions.expectedContents == null ? expectedWinContents : checkOptions.expectedContents - assertThat(files).isEqualTo(expectedContents.map(it => { + assertThat(files).isEqualTo(pathSorter(expectedContents.map(it => { if (it === "lib/net45/TestApp.exe") { - return `lib/net45/${encodeURI(appInfo.productFilename)}.exe` + if (appInfo.productFilename === "Test App ßW") { + return `lib/net45/Test%20App%20%C3%9FW.exe` + } + return `lib/net45/${encodeURI(appInfo.productFilename).replace(/%5B/g, '[').replace(/%5D/g, ']')}.exe` } else { return it } - })) + }))) if (checkOptions == null || checkOptions.expectedContents == null) { await unZipper.extractFile(fileDescriptors.filter(it => it.path === "TestApp.nuspec")[0], { @@ -310,12 +313,12 @@ async function checkWindowsResult(packager: Packager, checkOptions: AssertPackOp } } -async function getContents(path: string, productName: string) { +async function getContents(path: string) { const result = await exec("dpkg", ["--contents", path]) return pathSorter(result .split("\n") .map(it => it.length === 0 ? null : it.substring(it.indexOf(".") + 1)) - .filter(it => it != null && !(it.startsWith(`/opt/${productName}/locales/`) || it.startsWith(`/opt/${productName}/libgcrypt`))) + .filter(it => it != null && !(it.includes(`/locales/`) || it.includes(`/libgcrypt`))) ) } diff --git a/test/src/macPackagerTest.ts b/test/src/macPackagerTest.ts index 4a53bf60485..fe292b3d510 100644 --- a/test/src/macPackagerTest.ts +++ b/test/src/macPackagerTest.ts @@ -42,12 +42,12 @@ function createTargetTest(target: Array, expectedContents: Array }) } -test.ifOsx("only dmg", createTargetTest(["dmg"], ["Test App AB-1.1.0.dmg"])) -test.ifOsx("only zip", createTargetTest(["zip"], ["Test App AB-1.1.0-mac.zip"])) +test.ifOsx("only dmg", createTargetTest(["dmg"], ["Test App ßW-1.1.0.dmg"])) +test.ifOsx("only zip", createTargetTest(["zip"], ["Test App ßW-1.1.0-mac.zip"])) test.ifOsx("invalid target", (t: any) => t.throws(createTargetTest(["ttt"], [])(), "Unknown target: ttt")) -test.ifOsx("mas", createTargetTest(["mas"], ["Test App AB-1.1.0.pkg"])) -test.ifOsx("mas and 7z", createTargetTest(["mas", "7z"], ["Test App AB-1.1.0-mac.7z", "Test App AB-1.1.0.pkg"])) +test.ifOsx("mas", createTargetTest(["mas"], ["Test App ßW-1.1.0.pkg"])) +test.ifOsx("mas and 7z", createTargetTest(["mas", "7z"], ["Test App ßW-1.1.0-mac.7z", "Test App ßW-1.1.0.pkg"])) test.ifOsx("custom mas", () => { let platformPackager: CheckingOsXPackager = null diff --git a/test/tsconfig.json b/test/tsconfig.json index 0be1e2abaa9..3611bd28fe4 100755 --- a/test/tsconfig.json +++ b/test/tsconfig.json @@ -66,6 +66,7 @@ "src/ArtifactPublisherTest.ts", "src/BuildTest.ts", "src/CodeSignTest.ts", + "src/RepoSlugTest.ts", "src/globTest.ts", "src/helpers/avaEx.ts", "src/helpers/codeSignData.ts", @@ -76,7 +77,6 @@ "src/httpRequestTest.ts", "src/linuxPackagerTest.ts", "src/macPackagerTest.ts", - "src/RepoSlugTest.ts", "src/winPackagerTest.ts" ] } diff --git a/tsconfig.json b/tsconfig.json index da1751ddaaa..0865b5c0b8e 100755 --- a/tsconfig.json +++ b/tsconfig.json @@ -82,11 +82,11 @@ "src/packager.ts", "src/platformPackager.ts", "src/repositoryInfo.ts", + "src/targets/LinuxTargetHelper.ts", "src/targets/appImage.ts", "src/targets/archive.ts", "src/targets/dmg.ts", "src/targets/fpm.ts", - "src/targets/LinuxTargetHelper.ts", "src/targets/nsis.ts", "src/targets/squirrelWindows.ts", "src/targets/targetFactory.ts",