Merge pull request #2889 from xconverge/change-commandline-history-location

Move commandline history to XDG_CACHE_HOME or %APPDATA%
This commit is contained in:
Sean Kelly 2018-07-24 21:47:04 -07:00 committed by GitHub
commit e295565ec3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 2 deletions

View File

@ -600,9 +600,11 @@
"postinstall": "node ./node_modules/vscode/bin/install"
},
"dependencies": {
"appdirectory": "0.1.0",
"clipboardy": "1.2.3",
"diff-match-patch": "1.0.1",
"lodash": "4.17.10",
"mkdirp": "0.5.1",
"neovim-client": "2.1.0",
"promised-neovim-client": "2.0.2",
"untildify": "3.0.3",

View File

@ -3,6 +3,8 @@ import * as path from 'path';
import { configuration } from '../configuration/configuration';
import { logger } from '../util/logger';
const mkdirp = require('mkdirp');
export class CommandLineHistory {
private static readonly _historyFileName = '.cmdline_history';
private _historyDir: string;
@ -59,7 +61,7 @@ export class CommandLineHistory {
return new Promise<void>((resolve, reject) => {
try {
if (!fs.existsSync(this._historyDir)) {
fs.mkdirSync(this._historyDir, 0o775);
mkdirp.sync(this._historyDir, 0o775);
}
} catch (err) {
logger.error(

View File

@ -5,6 +5,8 @@ import { Position } from '../common/motion/position';
import { Range } from '../common/motion/range';
import { logger } from './logger';
const AppDirectory = require('appdirectory');
/**
* This is certainly quite janky! The problem we're trying to solve
* is that writing editor.selection = new Position() won't immediately
@ -38,5 +40,8 @@ export async function getCursorsAfterSync(timeout: number = 0): Promise<Range[]>
}
export function getExtensionDirPath(): string {
return path.join(os.homedir(), '.VSCodeVim');
const dirs = new AppDirectory('VSCodeVim');
logger.debug("VSCodeVim Cache Directory: " + dirs.userCache());
return dirs.userCache();
}