f6a29707b6
Resolves #18805. We want to keep default move conflict handling behavior in that it's still what most users would expect, but there exist edge cases in which users may not want to be forced into that behavior. This thus introduces an optional conflict handler that allows developers access to more granular move actions. They could now allow the user to choose whether to delete an existing app in favor of the current one being moved, or whether to quit the current app and focus on the existing one should it both exist and be running. I added a fair amount of new documentation outlining this behavior, but if there are things users may benefit from seeing examples of or nuances that should be added please leave feedback!
48 lines
1.4 KiB
C++
48 lines
1.4 KiB
C++
// Copyright (c) 2017 GitHub, Inc.
|
|
// Use of this source code is governed by the MIT license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#ifndef SHELL_BROWSER_UI_COCOA_ATOM_BUNDLE_MOVER_H_
|
|
#define SHELL_BROWSER_UI_COCOA_ATOM_BUNDLE_MOVER_H_
|
|
|
|
#include <string>
|
|
|
|
#include "native_mate/persistent_dictionary.h"
|
|
|
|
namespace electron {
|
|
|
|
// Possible bundle movement conflicts
|
|
enum class BundlerMoverConflictType { EXISTS, EXISTS_AND_RUNNING };
|
|
|
|
namespace ui {
|
|
|
|
namespace cocoa {
|
|
|
|
class AtomBundleMover {
|
|
public:
|
|
static bool Move(mate::Arguments* args);
|
|
static bool IsCurrentAppInApplicationsFolder();
|
|
|
|
private:
|
|
static bool ShouldContinueMove(BundlerMoverConflictType type,
|
|
mate::Arguments* args);
|
|
static bool IsInApplicationsFolder(NSString* bundlePath);
|
|
static NSString* ContainingDiskImageDevice(NSString* bundlePath);
|
|
static void Relaunch(NSString* destinationPath);
|
|
static NSString* ShellQuotedString(NSString* string);
|
|
static bool CopyBundle(NSString* srcPath, NSString* dstPath);
|
|
static bool AuthorizedInstall(NSString* srcPath,
|
|
NSString* dstPath,
|
|
bool* canceled);
|
|
static bool IsApplicationAtPathRunning(NSString* bundlePath);
|
|
static bool DeleteOrTrash(NSString* path);
|
|
static bool Trash(NSString* path);
|
|
};
|
|
|
|
} // namespace cocoa
|
|
|
|
} // namespace ui
|
|
|
|
} // namespace electron
|
|
|
|
#endif // SHELL_BROWSER_UI_COCOA_ATOM_BUNDLE_MOVER_H_
|