Skip to content

Commit

Permalink
Relax some rules, fix focus bug
Browse files Browse the repository at this point in the history
  • Loading branch information
johnste committed Nov 18, 2019
1 parent 4b40248 commit fae2052
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 22 deletions.
4 changes: 2 additions & 2 deletions Finicky/Finicky.xcodeproj/project.pbxproj
Expand Up @@ -465,7 +465,7 @@
INFOPLIST_FILE = Finicky/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.12;
MARKETING_VERSION = v2.2.2;
MARKETING_VERSION = v2.2.3;
PRODUCT_BUNDLE_IDENTIFIER = net.kassett.finicky;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Finicky/Finicky-Bridging-Header.h";
Expand All @@ -482,7 +482,7 @@
INFOPLIST_FILE = Finicky/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.12;
MARKETING_VERSION = v2.2.2;
MARKETING_VERSION = v2.2.3;
PRODUCT_BUNDLE_IDENTIFIER = net.kassett.finicky;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Finicky/Finicky-Bridging-Header.h";
Expand Down
19 changes: 9 additions & 10 deletions Finicky/Finicky/AppDelegate.swift
Expand Up @@ -158,15 +158,15 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele

func getPidPath(pid: Int32) -> String? {
let pathBuffer = UnsafeMutablePointer<UInt8>.allocate(capacity: Int(MAXPATHLEN))
defer {
pathBuffer.deallocate()
}
let pathLength = proc_pidpath(pid, pathBuffer, UInt32(MAXPATHLEN))
defer {
pathBuffer.deallocate()
}
let pathLength = proc_pidpath(pid, pathBuffer, UInt32(MAXPATHLEN))

if pathLength > 0 {
let path = String(cString: pathBuffer)
if pathLength > 0 {
let path = String(cString: pathBuffer)
return path
}
}
return nil
}

Expand Down Expand Up @@ -229,9 +229,8 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
showTestConfigWindow(nil)
}

func openUrlWithBrowser(_ url: URL, bundleIdentifier: String, openInBackground: Bool?) {
// Launch in background by default if finicky isn't active to avoid something that causes some bug to happen...
let openInBackground = openInBackground ?? !isActive
func openUrlWithBrowser(_ url: URL, bundleIdentifier: String, openInBackground: Bool?) {
let openInBackground = openInBackground ?? false
print("Opening " + bundleIdentifier + " at: " + url.absoluteString)
let command = getBrowserCommand(bundleIdentifier, url: url, openInBackground: openInBackground)
shell(command)
Expand Down
2 changes: 1 addition & 1 deletion Finicky/Finicky/finickyConfigAPI.js
Expand Up @@ -229,7 +229,7 @@ var finickyConfigApi = (function (exports) {
url: validate.oneOf([
validate.string,
validate.shape({
protocol: validate.oneOf(["http", "https", "file"]).isRequired,
protocol: validate.string.isRequired,
username: validate.string,
password: validate.string,
host: validate.string.isRequired,
Expand Down
8 changes: 0 additions & 8 deletions config-api/src/cli.ts
Expand Up @@ -35,14 +35,6 @@ const url = args[0] || "https://example.com/test";

const protocol = urlParse(url).protocol.replace(":", "");

if (protocol !== "http" && protocol !== "https" && protocol !== "file") {
errorMessage(
chalk`Finicky only processes {underline file, http and https} urls. Supplied url has protocol:`,
protocol
);
process.exit(1);
}

console.log(chalk`Opening configuration file {dim ${configPath}}`);

let config;
Expand Down
2 changes: 1 addition & 1 deletion config-api/src/types.ts
Expand Up @@ -157,7 +157,7 @@ export const urlSchema = {
url: validate.oneOf([
validate.string,
validate.shape({
protocol: validate.oneOf(["http", "https", "file"]).isRequired,
protocol: validate.string.isRequired,
username: validate.string,
password: validate.string,
host: validate.string.isRequired,
Expand Down

0 comments on commit fae2052

Please sign in to comment.