From fbc1d4fe8a8174b662b7ac38438fc2551b10dcad Mon Sep 17 00:00:00 2001 From: Alex Liebowitz Date: Wed, 8 Mar 2017 01:50:38 -0500 Subject: [PATCH] Open and reveal files using Electron instead of daemon --- CHANGELOG.md | 2 +- js/component/file-actions.js | 8 +++++--- js/lbry.js | 8 -------- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 67e633181..bb4534586 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,7 +13,7 @@ Web UI version numbers should always match the corresponding version of LBRY App * ### Changed - * + * Open and reveal files using Electron instead of daemon * * diff --git a/js/component/file-actions.js b/js/component/file-actions.js index 583d094d1..c5987dd4b 100644 --- a/js/component/file-actions.js +++ b/js/component/file-actions.js @@ -7,6 +7,8 @@ import FormField from './form.js'; import {ToolTip} from '../component/tooltip.js'; import {DropDownMenu, DropDownMenuItem} from './menu.js'; +const {shell} = require('electron'); + let WatchLink = React.createClass({ propTypes: { streamName: React.PropTypes.string, @@ -123,8 +125,8 @@ let FileActionsRow = React.createClass({ } }, onOpenClick: function() { - if (this.state.fileInfo && this.state.fileInfo.completed) { - lbry.openFile(this.props.sdHash); + if (this.state.fileInfo && this.state.fileInfo.download_path) { + shell.openItem(this.state.fileInfo.download_path); } }, handleDeleteCheckboxClicked: function(event) { @@ -134,7 +136,7 @@ let FileActionsRow = React.createClass({ }, handleRevealClicked: function() { if (this.state.fileInfo && this.state.fileInfo.download_path) { - lbry.revealFile(this.props.sdHash); + shell.showItemInFolder(this.state.fileInfo.download_path); } }, handleRemoveClicked: function() { diff --git a/js/lbry.js b/js/lbry.js index e1857b803..1701c915c 100644 --- a/js/lbry.js +++ b/js/lbry.js @@ -314,14 +314,6 @@ lbry.removeFile = function(sdHash, name, deleteTargetFile=true, callback) { // N }, callback); } -lbry.openFile = function(sdHash, callback) { - lbry.call('open', {sd_hash: sdHash}, callback); -} - -lbry.revealFile = function(sdHash, callback) { - lbry.call('reveal', {sd_hash: sdHash}, callback); -} - lbry.getFileInfoWhenListed = function(name, callback, timeoutCallback, tryNum=0) { function scheduleNextCheckOrTimeout() { if (timeoutCallback && tryNum > 200) {