const updateShortcuts = function (callback) {
  const homeDirectory = fs.getHomeDirectory()
  if (homeDirectory) {
    const desktopShortcutPath = path.join(homeDirectory, 'Desktop', `${pkg.name}.lnk`)
    fs.access(desktopShortcutPath, function (desktopShortcutExists) {
      createShortcuts(function () {
        if (desktopShortcutExists) {
          callback()
        } else {
          fs.unlink(desktopShortcutPath, callback)
        }
      })
    })
  } else {
    createShortcuts(callback)
  }
}
Beispiel #2
0
updateShortcuts = function(callback) {
  var desktopShortcutPath, homeDirectory;
  if (homeDirectory = fs.getHomeDirectory()) {
    desktopShortcutPath = path.join(homeDirectory, 'Desktop', 'RoboPaint.lnk');
    return fs.exists(desktopShortcutPath, function(desktopShortcutExists) {
      return createShortcuts(function() {
        if (desktopShortcutExists) {
          return callback();
        } else {
          return fs.unlink(desktopShortcutPath, callback);
        }
      });
    });
  } else {
    return createShortcuts(callback);
  }
};
Beispiel #3
0
     items: {
       type: 'string'
     }
   }
 },
 themes: {
   type: 'array',
   default: ['one-dark-ui', 'one-dark-syntax'],
   items: {
     type: 'string'
   },
   description: 'Names of UI and syntax themes which will be used when Atom starts.'
 },
 projectHome: {
   type: 'string',
   default: path.join(fs.getHomeDirectory(), 'github'),
   description: 'The directory where projects are assumed to be located. Packages created using the Package Generator will be stored here by default.'
 },
 audioBeep: {
   type: 'boolean',
   default: true,
   description: 'Trigger the system\'s beep sound when certain actions cannot be executed or there are no results.'
 },
 destroyEmptyPanes: {
   type: 'boolean',
   default: true,
   title: 'Remove Empty Panes',
   description: 'When the last tab of a pane is closed, remove that pane as well.'
 },
 closeEmptyWindows: {
   type: 'boolean',
Beispiel #4
0
  initialize (params = {}) {
    // This will force TextEditorElement to register the custom element, so that
    // using `document.createElement('atom-text-editor')` works if it's called
    // before opening a buffer.
    require('./text-editor-element')

    this.window = params.window
    this.document = params.document
    this.blobStore = params.blobStore
    this.configDirPath = params.configDirPath

    const {devMode, safeMode, resourcePath, userSettings, projectSpecification} = this.getLoadSettings()

    ConfigSchema.projectHome = {
      type: 'string',
      default: path.join(fs.getHomeDirectory(), 'github'),
      description: 'The directory where projects are assumed to be located. Packages created using the Package Generator will be stored here by default.'
    }

    this.config.initialize({
      mainSource: this.enablePersistence && path.join(this.configDirPath, 'config.cson'),
      projectHomeSchema: ConfigSchema.projectHome
    })
    this.config.resetUserSettings(userSettings)

    if (projectSpecification != null && projectSpecification.config != null) {
      this.project.replace(projectSpecification)
    }

    this.menu.initialize({resourcePath})
    this.contextMenu.initialize({resourcePath, devMode})

    this.keymaps.configDirPath = this.configDirPath
    this.keymaps.resourcePath = resourcePath
    this.keymaps.devMode = devMode
    if (!this.keymaps.canLoadBundledKeymapsFromMemory()) {
      this.keymaps.loadBundledKeymaps()
    }

    this.commands.attach(this.window)

    this.styles.initialize({configDirPath: this.configDirPath})
    this.packages.initialize({devMode, configDirPath: this.configDirPath, resourcePath, safeMode})
    this.themes.initialize({configDirPath: this.configDirPath, resourcePath, safeMode, devMode})

    this.commandInstaller.initialize(this.getVersion())
    this.uriHandlerRegistry.registerHostHandler('core', CoreURIHandlers.create(this))
    this.autoUpdater.initialize()

    this.protocolHandlerInstaller.initialize(this.config, this.notifications)

    this.themes.loadBaseStylesheets()
    this.initialStyleElements = this.styles.getSnapshot()
    if (params.onlyLoadBaseStyleSheets) this.themes.initialLoadComplete = true
    this.setBodyPlatformClass()

    this.stylesElement = this.styles.buildStylesElement()
    this.document.head.appendChild(this.stylesElement)

    this.keymaps.subscribeToFileReadFailure()

    this.installUncaughtErrorHandler()
    this.attachSaveStateListeners()
    this.windowEventHandler.initialize(this.window, this.document)

    const didChangeStyles = this.didChangeStyles.bind(this)
    this.disposables.add(this.styles.onDidAddStyleElement(didChangeStyles))
    this.disposables.add(this.styles.onDidUpdateStyleElement(didChangeStyles))
    this.disposables.add(this.styles.onDidRemoveStyleElement(didChangeStyles))

    this.observeAutoHideMenuBar()

    this.disposables.add(this.applicationDelegate.onDidChangeHistoryManager(() => this.history.loadState()))
  }