Skip to content

Commit

Permalink
fix: Changing Icons (not updating on dist output)
Browse files Browse the repository at this point in the history
Closes #840
  • Loading branch information
develar committed Nov 12, 2016
1 parent 20026f1 commit b6951ad
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 25 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
"cuint": "^0.2.2",
"debug": "^2.3.2",
"electron-download": "2.1.2",
"electron-macos-sign": "~1.2.3",
"electron-macos-sign": "~1.3.2",
"fs-extra-p": "^2.0.6",
"hosted-git-info": "^2.1.5",
"ini": "^1.3.4",
Expand Down Expand Up @@ -134,7 +134,7 @@
[
"transform-inline-imports-commonjs",
{
"excludeModules": "path"
"excludeModules": ["path"]
}
]
]
Expand Down
8 changes: 1 addition & 7 deletions src/appInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,7 @@ export class AppInfo {
}

get copyright(): string {
const metadata = this.devMetadata.build
const old = (<any>metadata)["app-copyright"]
if (old != null) {
warn('"app-copyright" is deprecated — please use "copyright" instead')
}

const copyright = metadata.copyright || old
const copyright = this.devMetadata.build.copyright
if (copyright != null) {
return copyright
}
Expand Down
12 changes: 7 additions & 5 deletions src/packager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,13 @@ export class Packager implements BuildInfo {
throw new Error("osx-sign is deprecated and not supported — please see https://github.com/electron-userland/electron-builder/wiki/Code-Signing")
}
if (build["osx"] != null) {
throw new Error(`"osx" in the "build" is deprecated and not supported — please see use "mac" instead`)
throw new Error(`build.osx is deprecated and not supported — please use build.mac instead`)
}
if (build["app-copyright"] != null) {
throw new Error(`build.app-copyright is deprecated and not supported — please use build.copyright instead`)
}
if (build["app-category-type"] != null) {
throw new Error(`build.app-category-type is deprecated and not supported — please use build.mac.category instead`)
}

const author = appMetadata.author
Expand All @@ -218,10 +224,6 @@ export class Packager implements BuildInfo {
throw new Error(`'directories' in the 'build' is not correct. Please move 'directories' from 'build' to root`)
}

if (build.osx != null) {
warn('"build.osx" is deprecated — please use "mac" instead of "osx"')
}

if (build.prune != null) {
warn("prune is deprecated — development dependencies are never copied in any case")
}
Expand Down
18 changes: 8 additions & 10 deletions src/packager/mac.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { rename, readFile, writeFile, copy, unlink } from "fs-extra-p"
import { rename, readFile, writeFile, copy, unlink, utimes } from "fs-extra-p"
import * as path from "path"
import { parse as parsePlist, build as buildPlist } from "plist"
import BluebirdPromise from "bluebird-lst-c"
Expand Down Expand Up @@ -117,14 +117,8 @@ export async function createApp(packager: PlatformPackager<any>, appOutDir: stri
})
}

const oldCategory = (<any>buildMetadata)["app-category-type"]
if (oldCategory != null) {
warn("app-category-type is deprecated, please set as build.mac.category")
}

let category = packager.platformSpecificBuildOptions.category || (<any>buildMetadata).category || oldCategory
use(category || oldCategory, it => appPlist.LSApplicationCategoryType = it)
use(appInfo.copyright, it => appPlist.NSHumanReadableCopyright = it)
use(packager.platformSpecificBuildOptions.category || (<any>buildMetadata).category, it => appPlist.LSApplicationCategoryType = it)
appPlist.NSHumanReadableCopyright = appInfo.copyright

const promises: Array<BluebirdPromise<any | n>> = [
writeFile(appPlistFilename, buildPlist(appPlist)),
Expand All @@ -142,5 +136,9 @@ export async function createApp(packager: PlatformPackager<any>, appOutDir: stri
await BluebirdPromise.all(promises)

await moveHelpers(frameworksPath, appFilename)
await rename(path.dirname(contentsPath), path.join(appOutDir, `${appFilename}.app`))
const appPath = path.join(appOutDir, `${appFilename}.app`)
await rename(path.dirname(contentsPath), appPath)
// https://github.com/electron-userland/electron-builder/issues/840
const now = Date.now() / 1000
await utimes(appPath, now, now)
}
2 changes: 1 addition & 1 deletion src/targets/fpm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default class FpmTarget extends TargetEx {
private readonly desktopEntry: Promise<string>

constructor(name: string, private packager: LinuxPackager, private helper: LinuxTargetHelper, private outDir: string) {
super(name)
super(name, false)

this.scriptFiles = this.createScripts()
this.desktopEntry = helper.computeDesktopEntry(this.options)
Expand Down

0 comments on commit b6951ad

Please sign in to comment.