Skip to content

Commit

Permalink
Electron: resolve #7: Show storage location in Options screen
Browse files Browse the repository at this point in the history
  • Loading branch information
laurent22 committed Dec 8, 2017
1 parent a513f6f commit 0f343bc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions ElectronClient/app/gui/ConfigScreen.jsx
Expand Up @@ -5,6 +5,7 @@ const { Setting } = require('lib/models/setting.js');
const { bridge } = require('electron').remote.require('./bridge');
const { Header } = require('./Header.min.js');
const { themeStyle } = require('../theme.js');
const pathUtils = require('lib/path-utils.js');
const { _ } = require('lib/locale.js');

class ConfigScreenComponent extends React.Component {
Expand Down Expand Up @@ -146,6 +147,9 @@ class ConfigScreenComponent extends React.Component {
<div style={style}>
<Header style={headerStyle} />
<div style={containerStyle}>
<div style={Object.assign({}, theme.textStyle, {marginBottom: 20})}>
{_('Notes and settings are stored in: %s', pathUtils.toSystemSlashes(Setting.value('profileDir'), process.platform))}
</div>
{ settingComps }
<button onClick={() => {this.onSaveClick()}} style={buttonStyle}>{_('Save')}</button>
<button onClick={() => {this.onCancelClick()}} style={buttonStyle}>{_('Cancel')}</button>
Expand Down
7 changes: 6 additions & 1 deletion ReactNativeClient/lib/path-utils.js
Expand Up @@ -40,4 +40,9 @@ function safeFileExtension(e) {
return e.replace(/[^a-zA-Z0-9]/g, '')
}

module.exports = { basename, dirname, filename, isHidden, fileExtension, safeFileExtension };
function toSystemSlashes(path, os) {
if (os === 'win32') return path.replace(/\//g, "\\");
return path.replace(/\\/g, "/");
}

module.exports = { basename, dirname, filename, isHidden, fileExtension, safeFileExtension, toSystemSlashes };

0 comments on commit 0f343bc

Please sign in to comment.