<commit_before>BrowserWindow = require 'browser-window'
Menu = require 'menu'
ContextMenu = require './context-menu'
dialog = require 'dialog'
ipc = require 'ipc'
path = require 'path'
fs = require 'fs'
_ = require 'underscore-plus'

# Private:
module.exports =
class AtomWindow
  @iconPath: path.resolve(__dirname, '..', '..', 'resources', 'atom.png')
  @includeShellLoadTime: true

  browserWindow: null
  loaded: null
  isSpec: null

  constructor: (settings={}) ->
    {@resourcePath, pathToOpen, initialLine, @isSpec} = settings
    global.atomApplication.addWindow(this)

    @setupNodePath(@resourcePath)
    @browserWindow = new BrowserWindow show: false, title: 'Atom', icon: @constructor.iconPath
    @browserWindow.restart = _.wrap _.bind(@browserWindow.restart, @browserWindow), (restart) =>
      @setupNodePath(@resourcePath)
      restart()

    @handleEvents()

    loadSettings = _.extend({}, settings)
    loadSettings.windowState ?= ''

    # Only send to the first non-spec window created
    if @constructor.includeShellLoadTime and not @isSpec
      @constructor.includeShellLoadTime = false
      loadSettings.shellLoadTime ?= Date.now() - global.shellStartTime

    loadSettings.initialPath = pathToOpen
    if fs.statSyncNoException(pathToOpen).isFile?()
      loadSettings.initialPath = path.dirname(pathToOpen)

    @browserWindow.loadSettings = loadSettings
    @browserWindow.once 'window:loaded', => @loaded = true
    @browserWindow.loadUrl "file://#{@resourcePath}/static/index.html"
    @browserWindow.focusOnWebView() if @isSpec

    @openPath(pathToOpen, initialLine)

  setupNodePath: (resourcePath) ->
    process.env['NODE_PATH'] = path.resolve(resourcePath, 'exports')
<commit_msg>Default windowState to empty hash JSON string<commit_after>BrowserWindow = require 'browser-window'
Menu = require 'menu'
ContextMenu = require './context-menu'
dialog = require 'dialog'
ipc = require 'ipc'
path = require 'path'
fs = require 'fs'
_ = require 'underscore-plus'

# Private:
module.exports =
class AtomWindow
  @iconPath: path.resolve(__dirname, '..', '..', 'resources', 'atom.png')
  @includeShellLoadTime: true

  browserWindow: null
  loaded: null
  isSpec: null

  constructor: (settings={}) ->
    {@resourcePath, pathToOpen, initialLine, @isSpec} = settings
    global.atomApplication.addWindow(this)

    @setupNodePath(@resourcePath)
    @browserWindow = new BrowserWindow show: false, title: 'Atom', icon: @constructor.iconPath
    @browserWindow.restart = _.wrap _.bind(@browserWindow.restart, @browserWindow), (restart) =>
      @setupNodePath(@resourcePath)
      restart()

    @handleEvents()

    loadSettings = _.extend({}, settings)
    loadSettings.windowState ?= '{}'

    # Only send to the first non-spec window created
    if @constructor.includeShellLoadTime and not @isSpec
      @constructor.includeShellLoadTime = false
      loadSettings.shellLoadTime ?= Date.now() - global.shellStartTime

    loadSettings.initialPath = pathToOpen
    if fs.statSyncNoException(pathToOpen).isFile?()
      loadSettings.initialPath = path.dirname(pathToOpen)

    @browserWindow.loadSettings = loadSettings
    @browserWindow.once 'window:loaded', => @loaded = true
    @browserWindow.loadUrl "file://#{@resourcePath}/static/index.html"
    @browserWindow.focusOnWebView() if @isSpec

    @openPath(pathToOpen, initialLine)

  setupNodePath: (resourcePath) ->
    process.env['NODE_PATH'] = path.resolve(resourcePath, 'exports')

{'fraction_non_alphanumeric': 0.12607944732297063, 'fraction_numerical': 0.0, 'mean_word_length': 4.438184663536776, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3720936', 'n_tokens_mistral': 1038, 'n_tokens_neox': 1019, 'n_words': 228}