Skip to content
Snippets Groups Projects
Commit af43e975 authored by George Nachman's avatar George Nachman
Browse files

Add PFMoveApplication, which offers to move the app to /Applications or...

Add PFMoveApplication, which offers to move the app to /Applications or ~/Applications on first launch
parent 7762e53a
No related branches found
No related tags found
No related merge requests found
//
// PFMoveApplication.h, version 1.21
// LetsMove
//
// Created by Andy Kim at Potion Factory LLC on 9/17/09
//
// The contents of this file are dedicated to the public domain.
#ifdef __cplusplus
extern "C" {
#endif
void PFMoveToApplicationsFolderIfNecessary(void);
#ifdef __cplusplus
}
#endif
This diff is collapsed.
LetsMove
========
A sample project that demonstrates how to move a running Mac OS X application to the Applications folder.
![Screenshot](http://i.imgur.com/euTRZiI.png)
Requirements
------------
Builds and runs on Mac OS X 10.6 or higher. Does NOT support sandboxed applications.
Usage
-----
Option 1:
Build then embed LetsMove.framework into your app.
Option 2:
Copy the following files into your project:
- PFMoveApplication.h
- PFMoveApplication.m
If your project has ARC enabled, you'll want to disable ARC on the above files. You can do so by adding -fno-objc-arc compiler flag to your PFMoveApplication.m source file. See http://stackoverflow.com/questions/6646052/how-can-i-disable-arc-for-a-single-file-in-a-project/6658549#6658549
If your application is localized, also copy the 'MoveApplication.string' files into your project.
Link your application against Security.framework.
In your app delegate's "-[applicationWillFinishLaunching:]" method, call the PFMoveToApplicationsFolderIfNecessary function at the very top.
License
-------
Public domain
Version History
---------------
* 1.21
- Support for [Carthage](https://github.com/Carthage/Carthage) added
- Project now support OS X 10.6 and higher
* 1.20
- Support for applications bundled inside another application
- Brazilian Portuguese localization slightly updated
- Build warnings fixed
* 1.19
- Slovak localization added
* 1.18
- Catalan localization added
* 1.17
- Tranditional Chinese localization added.
* 1.16
- Deprecation warning that appears when minimum deployment target is set to OS X 10.10 taken care of
* 1.15
- Swedish localization added
* 1.14
- Hugarian, Serbian, and Turkish localizations added
- Macedonian localization added
* 1.13
- Polish localization added
* 1.12
- Use country code based .lproj directories
- Make it compile for projects that don't use precompiled headers to import AppKit.framework
- Minor adjustment to Dutch localization
- Warning fixes in example project
* 1.11
- Objective-C++ compatibility
* 1.10
- Fixed deprecation warnings that show up when building against the OS X 10.9 SDK.
* 1.9
- Removed OS X 10.4 support
- Properly detect if the running app is in a disk image
- Fixed a bug where if the app's name contained a quote, the app could not be moved
- After a successful move, delete the application instead of moving it to the Trash.
- Other fixes and improvements
* 1.8
- If the app is already there in the Applications folder but not writable, request authentication from user
- Added Korean localization
* 1.7.2
- Fixed an exception that could happen.
* 1.7.1
- Refactoring
* 1.7
- Only move to ~/Appilcations directory if an app is already in there.
* 1.6.3
- Function calls deprecated in 10.7 no longer cause compile time warnings.
- Added Simplified Chinese and European Portuguese localizations
* 1.6.2
- Garbage collection compatibility added
- Use a new method to check if an application is already running on Mac OS X 10.6 systems or higher
* 1.6.1
- Use exit(0) to terminate the app before relaunching instead of [NSApp terminate:]. We don't want applicationShouldTerminate or applicationWillTerminate NSApplication delegate methods to be called, possibly introducing side effects.
* 1.6
- Resolve any aliases when finding the Applications directory
* 1.5.2
- Cleaned up the code a bit. Almost functionally equivalent to 1.5.1.
* 1.5.1
- Fixed a bug with clearing the quarantine file attribute on Mac OS X 10.5
* 1.5
- Don't prompt to move the application if it has "Applications" in its path somewhere
* 1.4
- Mac OS X 10.5 compatibility fixes
* 1.3
- Fixed a rare bug in the shell script that checks to see if the app is already running
- Clear quarantine flag after copying
- Compile time option to show normal sized alert supress checkbox button
- German, Danish, and Norwegian localizations added
* 1.2
- Copy application from disk image then unmount disk image
- Spanish, French, Dutch, and Russian localizations
* 1.1
- Prefers ~/Applications over /Applications if it exists
- Escape key pushes the "Do Not Move" button
* 1.0
- First release
Code Contributors:
-------------
* Andy Kim
* John Brayton
* Chad Sellers
* Kevin LaCoste
* Rasmus Andersson
* Timothy J. Wood
* Matt Gallagher
* Whitney Young
* Nick Moore
* Nicholas Riley
* Matt Prowse
Translators:
------------
* Eita Hayashi (Japanese)
* Gleb M. Borisov (Russian)
* Wouter Broekhof (Dutch)
* Rasmus Andersson / Spotify (French and Spanish)
* Markus Kirschner (German)
* Fredrik Nannestad (Danish)
* Georg Alexander Bøe (Norwegian)
* Marco Improda (Italian)
* Venj Chu (Simplified Chinese)
* Sérgio Miranda (European Portuguese)
* Victor Figueiredo and BR Lingo (Brazilian Portuguese)
* AppLingua (Korean)
* Czech X Team (Czech)
* Marek Telecki (Polish)
* Petar Vlahu (Macedonian)
* Václav Slavík (Hungarian, Serbian, and Turkish)
* Erik Vikström (Swedish)
* Inndy Lin (Traditional Chinese)
* aONe (Catalan)
* Marek Hrusovsky (Slovak)
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
Loading
Loading
@@ -1325,6 +1325,8 @@
A647E3A918C353C500450FA1 /* VT100StringParser.h in Headers */ = {isa = PBXBuildFile; fileRef = A647E3A718C353C500450FA1 /* VT100StringParser.h */; };
A647E3AE18C3588800450FA1 /* VT100ControlParser.h in Headers */ = {isa = PBXBuildFile; fileRef = A647E3AC18C3588800450FA1 /* VT100ControlParser.h */; };
A647E3B718C5884600450FA1 /* iTermObjectPool.h in Headers */ = {isa = PBXBuildFile; fileRef = A647E3B518C5884600450FA1 /* iTermObjectPool.h */; };
A658716A1D85E6700061CEEE /* PFMoveApplication.h in Headers */ = {isa = PBXBuildFile; fileRef = A65871681D85E6700061CEEE /* PFMoveApplication.h */; };
A658716B1D85E6750061CEEE /* PFMoveApplication.m in Sources */ = {isa = PBXBuildFile; fileRef = A65871671D85E6700061CEEE /* PFMoveApplication.m */; };
A65B72521B1A5D7500F947A7 /* WarningSign.png in Resources */ = {isa = PBXBuildFile; fileRef = A65B72501B1A5D7500F947A7 /* WarningSign.png */; };
A65B72531B1A5D7500F947A7 /* WarningSign.png in Resources */ = {isa = PBXBuildFile; fileRef = A65B72501B1A5D7500F947A7 /* WarningSign.png */; };
A65B72541B1A5D7500F947A7 /* WarningSign.png in Resources */ = {isa = PBXBuildFile; fileRef = A65B72501B1A5D7500F947A7 /* WarningSign.png */; };
Loading
Loading
@@ -3007,6 +3009,8 @@
A647E3B518C5884600450FA1 /* iTermObjectPool.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = iTermObjectPool.h; sourceTree = "<group>"; tabWidth = 4; };
A647E3B618C5884600450FA1 /* iTermObjectPool.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = iTermObjectPool.m; sourceTree = "<group>"; tabWidth = 4; };
A64AB26219B97B670033DB9C /* iTerm2ForApplescriptTesting-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "iTerm2ForApplescriptTesting-Info.plist"; sourceTree = "<group>"; };
A65871671D85E6700061CEEE /* PFMoveApplication.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PFMoveApplication.m; path = LetsMove/PFMoveApplication.m; sourceTree = "<group>"; };
A65871681D85E6700061CEEE /* PFMoveApplication.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PFMoveApplication.h; path = LetsMove/PFMoveApplication.h; sourceTree = "<group>"; };
A65B72501B1A5D7500F947A7 /* WarningSign.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = WarningSign.png; path = images/WarningSign.png; sourceTree = "<group>"; };
A65B72511B1A5D7500F947A7 /* WarningSign@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "WarningSign@2x.png"; path = "images/WarningSign@2x.png"; sourceTree = "<group>"; };
A65B72581B1A630100F947A7 /* CheckMark.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = CheckMark.png; path = images/CheckMark.png; sourceTree = "<group>"; };
Loading
Loading
@@ -4093,6 +4097,7 @@
1D03D42519144B8E0049EB8F /* ThirdParty */ = {
isa = PBXGroup;
children = (
A65871661D85E6660061CEEE /* LetsMove */,
1D1F8C171A32616A00167161 /* AMIndeterminateProgressIndicator */,
F6441F610E748404000EC682 /* CGSInternal */,
0464AB2E006CD2EC7F000001 /* External Frameworks and Libraries */,
Loading
Loading
@@ -4717,6 +4722,15 @@
name = VT100;
sourceTree = "<group>";
};
A65871661D85E6660061CEEE /* LetsMove */ = {
isa = PBXGroup;
children = (
A65871671D85E6700061CEEE /* PFMoveApplication.m */,
A65871681D85E6700061CEEE /* PFMoveApplication.h */,
);
name = LetsMove;
sourceTree = "<group>";
};
A663012119D08638004AF81C /* SCEvents */ = {
isa = PBXGroup;
children = (
Loading
Loading
@@ -5856,6 +5870,7 @@
1D7C18811275D22900461E55 /* PasteboardHistory.h in Headers */,
1D7C1D1212772ECC00461E55 /* NSDateFormatterExtras.h in Headers */,
1DE214E1128212EE004E3ADF /* Autocomplete.h in Headers */,
A658716A1D85E6700061CEEE /* PFMoveApplication.h in Headers */,
A6E713AD18F7CF73008D94DD /* ProfilesGeneralPreferencesViewController.h in Headers */,
A68A30F4186D150A007F550F /* FileTransferManager.h in Headers */,
1DD39B1A180B82F5004E56D5 /* DebugLogging.h in Headers */,
Loading
Loading
@@ -7700,6 +7715,7 @@
A6C763921B45C52B00E3C992 /* iTermFileDescriptorClient.c in Sources */,
A6C7631A1B45C52B00E3C992 /* iTermProfileSearchToken.m in Sources */,
A6C762FB1B45C52B00E3C992 /* FileTransferManager.m in Sources */,
A658716B1D85E6750061CEEE /* PFMoveApplication.m in Sources */,
A6C762B81B45C52B00E3C992 /* NSImage+iTerm.m in Sources */,
1D300BAB1BD9A8BB002043F7 /* NSDate+iTerm.m in Sources */,
A6C762E61B45C52B00E3C992 /* VT100Grid.m in Sources */,
Loading
Loading
Loading
Loading
@@ -56,6 +56,7 @@
#import "NSFileManager+iTerm.h"
#import "NSStringITerm.h"
#import "NSView+RecursiveDescription.h"
#import "PFMoveApplication.h"
#import "PreferencePanel.h"
#import "PseudoTerminal.h"
#import "PseudoTerminalRestorer.h"
Loading
Loading
@@ -154,11 +155,13 @@ static BOOL hasBecomeActive = NO;
 
// NSApplication delegate methods
- (void)applicationWillFinishLaunching:(NSNotification *)aNotification {
PFMoveToApplicationsFolderIfNecessary();
// Start automatic debug logging if it's enabled.
if ([iTermAdvancedSettingsModel startDebugLoggingAutomatically]) {
TurnOnDebugLoggingSilently();
}
if ([iTermAdvancedSettingsModel hideFromDockAndAppSwitcher]) {
ProcessSerialNumber psn = { 0, kCurrentProcess };
TransformProcessType(&psn, kProcessTransformToUIElementApplication);
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment