mirror of
https://github.com/Eugeny/tabby.git
synced 2025-07-21 02:48:00 +00:00
handle directory paths supplied on cli (fixes #90)
This commit is contained in:
@@ -9,12 +9,12 @@ export class ElectronService {
|
|||||||
clipboard: any
|
clipboard: any
|
||||||
globalShortcut: any
|
globalShortcut: any
|
||||||
screen: any
|
screen: any
|
||||||
|
remote: any
|
||||||
private electron: any
|
private electron: any
|
||||||
private remoteElectron: any
|
|
||||||
|
|
||||||
constructor () {
|
constructor () {
|
||||||
this.electron = require('electron')
|
this.electron = require('electron')
|
||||||
this.remoteElectron = this.remoteRequire('electron')
|
this.remote = this.electron.remote
|
||||||
this.app = this.electron.remote.app
|
this.app = this.electron.remote.app
|
||||||
this.screen = this.electron.remote.screen
|
this.screen = this.electron.remote.screen
|
||||||
this.dialog = this.electron.remote.dialog
|
this.dialog = this.electron.remote.dialog
|
||||||
@@ -25,6 +25,6 @@ export class ElectronService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
remoteRequire (name: string): any {
|
remoteRequire (name: string): any {
|
||||||
return this.electron.remote.require(name)
|
return this.remote.require(name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
import * as fs from 'mz/fs'
|
import * as fs from 'mz/fs'
|
||||||
import * as path from 'path'
|
import * as path from 'path'
|
||||||
import { Injectable } from '@angular/core'
|
import { Injectable } from '@angular/core'
|
||||||
import { HotkeysService, ToolbarButtonProvider, IToolbarButton, AppService, ConfigService, HostAppService } from 'terminus-core'
|
import { HotkeysService, ToolbarButtonProvider, IToolbarButton, AppService, ConfigService, HostAppService, ElectronService } from 'terminus-core'
|
||||||
|
|
||||||
import { SessionsService } from './services/sessions.service'
|
import { SessionsService } from './services/sessions.service'
|
||||||
import { ShellsService } from './services/shells.service'
|
import { ShellsService } from './services/shells.service'
|
||||||
@@ -14,6 +14,7 @@ export class ButtonProvider extends ToolbarButtonProvider {
|
|||||||
private sessions: SessionsService,
|
private sessions: SessionsService,
|
||||||
private config: ConfigService,
|
private config: ConfigService,
|
||||||
private shells: ShellsService,
|
private shells: ShellsService,
|
||||||
|
electron: ElectronService,
|
||||||
hostApp: HostAppService,
|
hostApp: HostAppService,
|
||||||
hotkeys: HotkeysService,
|
hotkeys: HotkeysService,
|
||||||
) {
|
) {
|
||||||
@@ -31,6 +32,18 @@ export class ButtonProvider extends ToolbarButtonProvider {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
if (!electron.remote.process.env.DEV) {
|
||||||
|
setImmediate(async () => {
|
||||||
|
let argv: string[] = electron.remote.process.argv
|
||||||
|
for (let arg of argv.slice(1)) {
|
||||||
|
if (await fs.exists(arg)) {
|
||||||
|
if ((await fs.stat(arg)).isDirectory()) {
|
||||||
|
this.openNewTab(arg)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async openNewTab (cwd?: string): Promise<void> {
|
async openNewTab (cwd?: string): Promise<void> {
|
||||||
|
Reference in New Issue
Block a user