@Override public Local find() { return new FinderLocal(NSFileManager.defaultManager().currentDirectoryPath()); } }
@Override public Local find() { final NSBundle b = this.bundle(); if(null == b) { log.warn("No main bundle found"); return new TemporarySupportDirectoryFinder().find(); } final Local folder = new FinderLocal(b.resourcePath()); if(log.isDebugEnabled()) { log.debug(String.format("Use folder %s for application resources directory", folder)); } return folder; }
@Override public Local find() { final NSArray directories = FoundationKitFunctionsLibrary.NSSearchPathForDirectoriesInDomains( FoundationKitFunctions.NSSearchPathDirectory.NSApplicationSupportDirectory, FoundationKitFunctions.NSSearchPathDomainMask.NSUserDomainMask, true); final String application = preferences.getProperty("application.name"); if(directories.count().intValue() == 0) { log.error("Failed searching for application support directory"); return new FinderLocal("~/Library/Application Support", application); } else { final String directory = directories.objectAtIndex(new NSUInteger(0)).toString(); if(log.isInfoEnabled()) { log.info(String.format("Found application support directory in %s", directory)); } final Local folder = new FinderLocal(directory, application); if(log.isDebugEnabled()) { log.debug(String.format("Use folder %s for application support directory", folder)); } return folder; } } }
public NSBundle bundle() { if(cached != null) { return cached; } if(log.isInfoEnabled()) { log.info("Loading application bundle resources"); } final NSBundle main = NSBundle.mainBundle(); if(null == main) { cached = null; } else { final Local executable = new FinderLocal(main.executablePath()); cached = this.bundle(main, executable); } return cached; }
log.error(String.format("Loading bundle %s failed", path)); identifier = search; name = FilenameUtils.removeExtension(new FinderLocal(path).getDisplayName()); if(null == bundlename) { log.warn(String.format("No CFBundleName in bundle %s", path)); name = FilenameUtils.removeExtension(new FinderLocal(path).getDisplayName());
/** * This function works only with executables stored in the * <code>Contents/Library/LoginItems</code> directory of the bundle. */ @Override public boolean register(final Application application) { final Local helper = new FinderLocal(new BundleApplicationResourcesFinder().find().getParent(), String.format("Library/LoginItems/%s.app", application.getName())); if(!finder.register(helper)) { log.warn(String.format("Failed to register %s (%s) with launch services", helper, finder.getDescription(application.getIdentifier()))); } if(!ServiceManagementLibrary.SMLoginItemSetEnabled(application.getIdentifier(), true)) { log.warn(String.format("Failed to register %s as login item", application)); return false; } return true; }
@Override public boolean register(final Application application) { try { if(finder.isInstalled(application)) { service.add(new FinderLocal(NSWorkspace.sharedWorkspace().absolutePathForAppBundleWithIdentifier(application.getIdentifier()))); return true; } return false; } catch(LocalAccessDeniedException e) { return false; } }
@Override public boolean unregister(final Application application) { try { if(finder.isInstalled(application)) { service.remove(new FinderLocal(NSWorkspace.sharedWorkspace().absolutePathForAppBundleWithIdentifier(application.getIdentifier()))); return true; } return false; } catch(LocalAccessDeniedException e) { return false; } } }
final Local folder = new FinderLocal(String.format("%s/Library/Application Support", group.path()), application); try {
@Override public void run() { final NSOpenPanel panel = NSOpenPanel.openPanel(); panel.setCanChooseDirectories(file.isDirectory()); panel.setCanChooseFiles(file.isFile()); panel.setAllowsMultipleSelection(false); panel.setMessage(MessageFormat.format(LocaleFactory.localizedString("Select {0}", "Credentials"), file.getAbbreviatedPath())); panel.setPrompt(LocaleFactory.localizedString("Choose")); final NSInteger modal = panel.runModal(file.getParent().getAbsolute(), file.getName()); if(modal.intValue() == SheetCallback.DEFAULT_OPTION) { final NSArray filenames = panel.filenames(); final NSEnumerator enumerator = filenames.objectEnumerator(); NSObject next; while((next = enumerator.nextObject()) != null) { selected.set(new FinderLocal(next.toString())); } } panel.orderOut(null); } };
this.setDefault("bookmark.import.expandrive5.location", "~/Library/Application Support/ExpanDrive/expandrive5.favorites.js"); this.setDefault("bookmark.import.expandrive6.location", "~/Library/Application Support/ExpanDrive/expandrive6.favorites.js"); if(new FinderLocal("~/Downloads").exists()) {