Browse Source

Merge pull request #1091 from meriadec/feature/1085-open-user-data-folder

Fixes #1085
master
Gaëtan Renaudeau 7 years ago
committed by GitHub
parent
commit
efab95ddaa
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 30
      src/components/OpenUserDataDirectoryBtn.js
  2. 7
      src/components/SettingsPage/sections/Help.js
  3. 10
      src/helpers/resolveUserDataDirectory.js
  4. 4
      static/i18n/en/app.yml
  5. 4
      static/i18n/fr/app.yml

30
src/components/OpenUserDataDirectoryBtn.js

@ -0,0 +1,30 @@
// @flow
import React, { Component } from 'react'
import logger from 'logger'
import { shell } from 'electron'
import { translate } from 'react-i18next'
import resolveUserDataDirectory from 'helpers/resolveUserDataDirectory'
import Button from 'components/base/Button'
class OpenUserDataDirectoryBtn extends Component<{
t: *,
}> {
handleOpenUserDataDirectory = async () => {
const userDataDirectory = resolveUserDataDirectory()
logger.log(`Opening user data directory: ${userDataDirectory}`)
shell.openItem(userDataDirectory)
}
render() {
const { t } = this.props
return (
<Button primary small onClick={this.handleOpenUserDataDirectory}>
{t('app:settings.openUserDataDirectory.btn')}
</Button>
)
}
}
export default translate()(OpenUserDataDirectoryBtn)

7
src/components/SettingsPage/sections/Help.js

@ -9,6 +9,7 @@ import resolveLogsDirectory from 'helpers/resolveLogsDirectory'
import { urls } from 'config/urls'
import ExportLogsBtn from 'components/ExportLogsBtn'
import OpenUserDataDirectoryBtn from 'components/OpenUserDataDirectoryBtn'
import CleanButton from '../CleanButton'
import ResetButton from '../ResetButton'
import AboutRowItem from '../AboutRowItem'
@ -56,6 +57,12 @@ class SectionHelp extends PureComponent<Props> {
>
<ExportLogsBtn />
</Row>
<Row
title={t('app:settings.openUserDataDirectory.title')}
desc={t('app:settings.openUserDataDirectory.desc')}
>
<OpenUserDataDirectoryBtn />
</Row>
<Row
title={t('app:settings.profile.hardResetTitle')}
desc={t('app:settings.profile.hardResetDesc')}

10
src/helpers/resolveUserDataDirectory.js

@ -0,0 +1,10 @@
// @flow
const resolveUserDataDirectory = () => {
const { LEDGER_CONFIG_DIRECTORY } = process.env
if (LEDGER_CONFIG_DIRECTORY) return LEDGER_CONFIG_DIRECTORY
const electron = require('electron')
return (electron.app || electron.remote.app).getPath('userData')
}
export default resolveUserDataDirectory

4
static/i18n/en/app.yml

@ -382,6 +382,10 @@ settings:
title: Remove account
subTitle: Are you sure?
desc: The account will no longer be included in your portfolio. This operation does not affect your assets. Accounts can always be re-added.
openUserDataDirectory:
title: 'Open user data directory'
desc: 'Open the user data directory'
btn: 'Open'
exportLogs:
title: Export logs
desc: 'Exporting Ledger Live logs may be necessary for troubleshooting purposes.'

4
static/i18n/fr/app.yml

@ -382,6 +382,10 @@ settings:
title: Remove account
subTitle: Are you sure?
desc: The account will no longer be included in your portfolio. This operation does not affect your assets. Accounts can always be re-added.
openUserDataDirectory:
title: 'Open user data directory'
desc: 'Open the user data directory'
btn: 'Open'
exportLogs:
title: Export logs
desc: 'Exporting Ledger Live logs may be necessary for troubleshooting purposes.'

Loading…
Cancel
Save