files.ts 20.2 KB
Newer Older
E
Erich Gamma 已提交
1 2 3 4 5 6
/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Microsoft Corporation. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/
'use strict';

J
Johannes Rieken 已提交
7
import { TPromise } from 'vs/base/common/winjs.base';
E
Erich Gamma 已提交
8 9 10
import paths = require('vs/base/common/paths');
import URI from 'vs/base/common/uri';
import glob = require('vs/base/common/glob');
11
import { isLinux } from 'vs/base/common/platform';
J
Johannes Rieken 已提交
12
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
13
import Event from 'vs/base/common/event';
14
import { beginsWithIgnoreCase } from 'vs/base/common/strings';
J
Johannes Rieken 已提交
15
import { IProgress } from 'vs/platform/progress/common/progress';
16
import { IDisposable } from 'vs/base/common/lifecycle';
17
import { isEqualOrParent, isEqual } from 'vs/base/common/resources';
B
Benjamin Pasero 已提交
18
import { isUndefinedOrNull } from 'vs/base/common/types';
E
Erich Gamma 已提交
19

B
Benjamin Pasero 已提交
20
export const IFileService = createDecorator<IFileService>('fileService');
E
Erich Gamma 已提交
21 22

export interface IFileService {
23
	_serviceBrand: any;
E
Erich Gamma 已提交
24

25 26 27 28 29 30 31 32 33 34 35
	/**
	 * Allows to listen for file changes. The event will fire for every file within the opened workspace
	 * (if any) as well as all files that have been watched explicitly using the #watchFileChanges() API.
	 */
	onFileChanges: Event<FileChangesEvent>;

	/**
	 * An event that is fired upon successful completion of a certain file operation.
	 */
	onAfterOperation: Event<FileOperationEvent>;

36
	/**
J
Johannes Rieken 已提交
37
	 * Registeres a file system provider for a certain scheme.
38
	 */
J
Johannes Rieken 已提交
39
	registerProvider?(scheme: string, provider: IFileSystemProvider): IDisposable;
40

J
Johannes Rieken 已提交
41 42 43 44
	/**
	 * Checks if this file service can handle the given resource.
	 */
	canHandleResource?(resource: URI): boolean;
45

E
Erich Gamma 已提交
46 47 48 49 50 51 52 53 54 55 56
	/**
	 * Resolve the properties of a file identified by the resource.
	 *
	 * If the optional parameter "resolveTo" is specified in options, the stat service is asked
	 * to provide a stat object that should contain the full graph of folders up to all of the
	 * target resources.
	 *
	 * If the optional parameter "resolveSingleChildDescendants" is specified in options,
	 * the stat service is asked to automatically resolve child folders that only
	 * contain a single element.
	 */
B
Benjamin Pasero 已提交
57
	resolveFile(resource: URI, options?: IResolveFileOptions): TPromise<IFileStat>;
E
Erich Gamma 已提交
58

I
isidor 已提交
59 60
	/**
	 * Same as resolveFile but supports resolving mulitple resources in parallel.
61
	 * If one of the resolve targets fails to resolve returns a fake IFileStat instead of making the whole call fail.
I
isidor 已提交
62
	 */
I
isidor 已提交
63
	resolveFiles(toResolve: { resource: URI, options?: IResolveFileOptions }[]): TPromise<IResolveFileResult[]>;
I
isidor 已提交
64

65 66 67
	/**
	 *Finds out if a file identified by the resource exists.
	 */
B
Benjamin Pasero 已提交
68
	existsFile(resource: URI): TPromise<boolean>;
69

E
Erich Gamma 已提交
70 71 72 73 74
	/**
	 * Resolve the contents of a file identified by the resource.
	 *
	 * The returned object contains properties of the file and the full value as string.
	 */
B
Benjamin Pasero 已提交
75
	resolveContent(resource: URI, options?: IResolveContentOptions): TPromise<IContent>;
E
Erich Gamma 已提交
76

A
Alex Dima 已提交
77 78 79 80 81
	/**
	 * Resolve the contents of a file identified by the resource.
	 *
	 * The returned object contains properties of the file and the value as a readable stream.
	 */
B
Benjamin Pasero 已提交
82
	resolveStreamContent(resource: URI, options?: IResolveContentOptions): TPromise<IStreamContent>;
A
Alex Dima 已提交
83

E
Erich Gamma 已提交
84 85 86
	/**
	 * Updates the content replacing its previous value.
	 */
87
	updateContent(resource: URI, value: string | ITextSnapshot, options?: IUpdateContentOptions): TPromise<IFileStat>;
E
Erich Gamma 已提交
88 89 90 91 92 93

	/**
	 * Moves the file to a new path identified by the resource.
	 *
	 * The optional parameter overwrite can be set to replace an existing file at the location.
	 */
B
Benjamin Pasero 已提交
94
	moveFile(source: URI, target: URI, overwrite?: boolean): TPromise<IFileStat>;
E
Erich Gamma 已提交
95 96 97 98 99 100

	/**
	 * Copies the file to a path identified by the resource.
	 *
	 * The optional parameter overwrite can be set to replace an existing file at the location.
	 */
B
Benjamin Pasero 已提交
101
	copyFile(source: URI, target: URI, overwrite?: boolean): TPromise<IFileStat>;
E
Erich Gamma 已提交
102 103 104 105 106 107 108

	/**
	 * Creates a new file with the given path. The returned promise
	 * will have the stat model object as a result.
	 *
	 * The optional parameter content can be used as value to fill into the new file.
	 */
109
	createFile(resource: URI, content?: string, options?: ICreateFileOptions): TPromise<IFileStat>;
E
Erich Gamma 已提交
110 111 112 113 114

	/**
	 * Creates a new folder with the given path. The returned promise
	 * will have the stat model object as a result.
	 */
B
Benjamin Pasero 已提交
115
	createFolder(resource: URI): TPromise<IFileStat>;
E
Erich Gamma 已提交
116 117 118 119 120

	/**
	 * Renames the provided file to use the new name. The returned promise
	 * will have the stat model object as a result.
	 */
B
Benjamin Pasero 已提交
121
	rename(resource: URI, newName: string): TPromise<IFileStat>;
E
Erich Gamma 已提交
122

123 124 125 126 127 128
	/**
	 * Creates a new empty file if the given path does not exist and otherwise
	 * will set the mtime and atime of the file to the current date.
	 */
	touchFile(resource: URI): TPromise<IFileStat>;

E
Erich Gamma 已提交
129 130 131 132
	/**
	 * Deletes the provided file.  The optional useTrash parameter allows to
	 * move the file to trash.
	 */
B
Benjamin Pasero 已提交
133
	del(resource: URI, useTrash?: boolean): TPromise<void>;
E
Erich Gamma 已提交
134 135 136 137

	/**
	 * Imports the file to the parent identified by the resource.
	 */
B
Benjamin Pasero 已提交
138
	importFile(source: URI, targetFolder: URI): TPromise<IImportResult>;
E
Erich Gamma 已提交
139 140 141 142 143 144 145 146 147 148 149 150 151 152

	/**
	 * Allows to start a watcher that reports file change events on the provided resource.
	 */
	watchFileChanges(resource: URI): void;

	/**
	 * Allows to stop a watcher on the provided resource or absolute fs path.
	 */
	unwatchFileChanges(resource: URI): void;

	/**
	 * Configures the file service with the provided options.
	 */
B
Benjamin Pasero 已提交
153
	updateOptions(options: object): void;
E
Erich Gamma 已提交
154

155 156 157
	/**
	 * Returns the preferred encoding to use for a given resource.
	 */
158
	getEncoding(resource: URI, preferredEncoding?: string): string;
159

E
Erich Gamma 已提交
160 161 162 163 164 165
	/**
	 * Frees up any resources occupied by this service.
	 */
	dispose(): void;
}

J
Johannes Rieken 已提交
166 167 168 169 170 171 172

export enum FileType {
	File = 0,
	Dir = 1,
	Symlink = 2
}
export interface IStat {
173
	id: number | string;
J
Johannes Rieken 已提交
174 175 176 177 178 179
	mtime: number;
	size: number;
	type: FileType;
}

export interface IFileSystemProvider {
J
Johannes Rieken 已提交
180

181
	onDidChange?: Event<IFileChange[]>;
J
Johannes Rieken 已提交
182 183 184

	// more...
	//
J
Johannes Rieken 已提交
185
	utimes(resource: URI, mtime: number, atime: number): TPromise<IStat>;
J
Johannes Rieken 已提交
186
	stat(resource: URI): TPromise<IStat>;
187
	read(resource: URI, offset: number, count: number, progress: IProgress<Uint8Array>): TPromise<number>;
J
Johannes Rieken 已提交
188
	write(resource: URI, content: Uint8Array): TPromise<void>;
189 190
	move(from: URI, to: URI): TPromise<IStat>;
	mkdir(resource: URI): TPromise<IStat>;
191
	readdir(resource: URI): TPromise<[URI, IStat][]>;
J
Johannes Rieken 已提交
192
	rmdir(resource: URI): TPromise<void>;
193
	unlink(resource: URI): TPromise<void>;
J
Johannes Rieken 已提交
194 195 196
}


197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221
export enum FileOperation {
	CREATE,
	DELETE,
	MOVE,
	COPY,
	IMPORT
}

export class FileOperationEvent {

	constructor(private _resource: URI, private _operation: FileOperation, private _target?: IFileStat) {
	}

	public get resource(): URI {
		return this._resource;
	}

	public get target(): IFileStat {
		return this._target;
	}

	public get operation(): FileOperation {
		return this._operation;
	}
}
E
Erich Gamma 已提交
222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237

/**
 * Possible changes that can occur to a file.
 */
export enum FileChangeType {
	UPDATED = 0,
	ADDED = 1,
	DELETED = 2
}

/**
 * Identifies a single change in a file.
 */
export interface IFileChange {

	/**
I
isidor 已提交
238
	 * The type of change that occurred to the file.
E
Erich Gamma 已提交
239 240 241 242 243 244 245
	 */
	type: FileChangeType;

	/**
	 * The unified resource identifier of the file that changed.
	 */
	resource: URI;
B
Benjamin Pasero 已提交
246
}
E
Erich Gamma 已提交
247

J
Johannes Rieken 已提交
248 249
export class FileChangesEvent {

E
Erich Gamma 已提交
250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269
	private _changes: IFileChange[];

	constructor(changes: IFileChange[]) {
		this._changes = changes;
	}

	public get changes() {
		return this._changes;
	}

	/**
	 * Returns true if this change event contains the provided file with the given change type. In case of
	 * type DELETED, this method will also return true if a folder got deleted that is the parent of the
	 * provided file path.
	 */
	public contains(resource: URI, type: FileChangeType): boolean {
		if (!resource) {
			return false;
		}

270
		return this._changes.some(change => {
E
Erich Gamma 已提交
271 272 273 274 275 276
			if (change.type !== type) {
				return false;
			}

			// For deleted also return true when deleted folder is parent of target path
			if (type === FileChangeType.DELETED) {
277
				return isEqualOrParent(resource, change.resource, !isLinux /* ignorecase */);
E
Erich Gamma 已提交
278 279
			}

280
			return isEqual(resource, change.resource, !isLinux /* ignorecase */);
E
Erich Gamma 已提交
281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326
		});
	}

	/**
	 * Returns the changes that describe added files.
	 */
	public getAdded(): IFileChange[] {
		return this.getOfType(FileChangeType.ADDED);
	}

	/**
	 * Returns if this event contains added files.
	 */
	public gotAdded(): boolean {
		return this.hasType(FileChangeType.ADDED);
	}

	/**
	 * Returns the changes that describe deleted files.
	 */
	public getDeleted(): IFileChange[] {
		return this.getOfType(FileChangeType.DELETED);
	}

	/**
	 * Returns if this event contains deleted files.
	 */
	public gotDeleted(): boolean {
		return this.hasType(FileChangeType.DELETED);
	}

	/**
	 * Returns the changes that describe updated files.
	 */
	public getUpdated(): IFileChange[] {
		return this.getOfType(FileChangeType.UPDATED);
	}

	/**
	 * Returns if this event contains updated files.
	 */
	public gotUpdated(): boolean {
		return this.hasType(FileChangeType.UPDATED);
	}

	private getOfType(type: FileChangeType): IFileChange[] {
327
		return this._changes.filter(change => change.type === type);
E
Erich Gamma 已提交
328 329 330
	}

	private hasType(type: FileChangeType): boolean {
331
		return this._changes.some(change => {
E
Erich Gamma 已提交
332 333 334 335 336
			return change.type === type;
		});
	}
}

337
export function isParent(path: string, candidate: string, ignoreCase?: boolean): boolean {
338 339 340 341
	if (!path || !candidate || path === candidate) {
		return false;
	}

B
Benjamin Pasero 已提交
342
	if (candidate.length > path.length) {
B
Benjamin Pasero 已提交
343 344 345
		return false;
	}

346 347 348 349
	if (candidate.charAt(candidate.length - 1) !== paths.nativeSep) {
		candidate += paths.nativeSep;
	}

350
	if (ignoreCase) {
351
		return beginsWithIgnoreCase(path, candidate);
B
Benjamin Pasero 已提交
352 353
	}

354
	return path.indexOf(candidate) === 0;
355 356
}

B
Benjamin Pasero 已提交
357

358

B
Benjamin Pasero 已提交
359
export function indexOf(path: string, candidate: string, ignoreCase?: boolean): number {
B
Benjamin Pasero 已提交
360 361 362 363 364 365 366 367
	if (candidate.length > path.length) {
		return -1;
	}

	if (path === candidate) {
		return 0;
	}

B
Benjamin Pasero 已提交
368
	if (ignoreCase) {
B
Benjamin Pasero 已提交
369 370 371 372 373 374 375
		path = path.toLowerCase();
		candidate = candidate.toLowerCase();
	}

	return path.indexOf(candidate);
}

E
Erich Gamma 已提交
376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407
export interface IBaseStat {

	/**
	 * The unified resource identifier of this file or folder.
	 */
	resource: URI;

	/**
	 * The name which is the last segement
	 * of the {{path}}.
	 */
	name: string;

	/**
	 * The last modifictaion date represented
	 * as millis from unix epoch.
	 */
	mtime: number;

	/**
	 * A unique identifier thet represents the
	 * current state of the file or directory.
	 */
	etag: string;
}

/**
 * A file resource with meta information.
 */
export interface IFileStat extends IBaseStat {

	/**
408
	 * The resource is a directory. if {{true}}
409
	 * {{encoding}} has no meaning.
E
Erich Gamma 已提交
410 411 412 413 414 415 416 417 418 419 420 421 422 423
	 */
	isDirectory: boolean;

	/**
	 * The children of the file stat or undefined if none.
	 */
	children?: IFileStat[];

	/**
	 * The size of the file if known.
	 */
	size?: number;
}

I
isidor 已提交
424 425 426 427 428
export interface IResolveFileResult {
	stat: IFileStat;
	success: boolean;
}

E
Erich Gamma 已提交
429 430 431 432 433 434 435 436 437 438 439
/**
 * Content and meta information of a file.
 */
export interface IContent extends IBaseStat {

	/**
	 * The content of a text file.
	 */
	value: string;

	/**
B
Benjamin Pasero 已提交
440
	 * The encoding of the content if known.
E
Erich Gamma 已提交
441
	 */
B
Benjamin Pasero 已提交
442
	encoding: string;
E
Erich Gamma 已提交
443 444
}

445 446 447 448 449 450 451 452
// this should eventually replace IContent such
// that we have a clear separation between content
// and metadata (TODO@Joh, TODO@Ben)
export interface IContentData {
	encoding: string;
	stream: IStringStream;
}

A
Alex Dima 已提交
453 454 455 456
/**
 * A Stream emitting strings.
 */
export interface IStringStream {
B
Benjamin Pasero 已提交
457 458 459 460
	on(event: 'data', callback: (chunk: string) => void): void;
	on(event: 'error', callback: (err: any) => void): void;
	on(event: 'end', callback: () => void): void;
	on(event: string, callback: any): void;
A
Alex Dima 已提交
461 462
}

463 464 465 466 467 468 469 470 471
/**
 * Text snapshot that works like an iterator.
 * Will try to return chunks of roughly ~64KB size.
 * Will return null when finished.
 */
export interface ITextSnapshot {
	read(): string;
}

472 473 474 475 476 477 478 479 480 481 482 483 484
/**
 * Helper method to convert a snapshot into its full string form.
 */
export function snapshotToString(snapshot: ITextSnapshot): string {
	const chunks: string[] = [];
	let chunk: string;
	while (typeof (chunk = snapshot.read()) === 'string') {
		chunks.push(chunk);
	}

	return chunks.join('');
}

A
Alex Dima 已提交
485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500
/**
 * Streamable content and meta information of a file.
 */
export interface IStreamContent extends IBaseStat {

	/**
	 * The streamable content of a text file.
	 */
	value: IStringStream;

	/**
	 * The encoding of the content if known.
	 */
	encoding: string;
}

E
Erich Gamma 已提交
501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520
export interface IResolveContentOptions {

	/**
	 * The optional acceptTextOnly parameter allows to fail this request early if the file
	 * contents are not textual.
	 */
	acceptTextOnly?: boolean;

	/**
	 * The optional etag parameter allows to return a 304 (Not Modified) if the etag matches
	 * with the remote resource. It is the task of the caller to makes sure to handle this
	 * error case from the promise.
	 */
	etag?: string;

	/**
	 * The optional encoding parameter allows to specify the desired encoding when resolving
	 * the contents of the file.
	 */
	encoding?: string;
521 522 523 524 525

	/**
	 * The optional guessEncoding parameter allows to guess encoding from content of the file.
	 */
	autoGuessEncoding?: boolean;
526 527 528 529 530 531

	/**
	 * Is an integer specifying where to begin reading from in the file. If position is null,
	 * data will be read from the current file position.
	 */
	position?: number;
E
Erich Gamma 已提交
532 533 534 535 536
}

export interface IUpdateContentOptions {

	/**
B
Benjamin Pasero 已提交
537
	 * The encoding to use when updating a file.
E
Erich Gamma 已提交
538
	 */
B
Benjamin Pasero 已提交
539
	encoding?: string;
E
Erich Gamma 已提交
540

B
wip  
Benjamin Pasero 已提交
541
	/**
B
Benjamin Pasero 已提交
542
	 * If set to true, will enforce the selected encoding and not perform any detection using BOMs.
B
wip  
Benjamin Pasero 已提交
543 544 545
	 */
	overwriteEncoding?: boolean;

E
Erich Gamma 已提交
546
	/**
P
Pascal Borreli 已提交
547
	 * Whether to overwrite a file even if it is readonly.
E
Erich Gamma 已提交
548 549 550
	 */
	overwriteReadonly?: boolean;

551 552 553 554 555 556
	/**
	 * Wether to write to the file as elevated (admin) user. When setting this option a prompt will
	 * ask the user to authenticate as super user.
	 */
	writeElevated?: boolean;

E
Erich Gamma 已提交
557 558 559 560 561 562 563 564 565 566 567 568 569 570 571
	/**
	 * The last known modification time of the file. This can be used to prevent dirty writes.
	 */
	mtime?: number;

	/**
	 * The etag of the file. This can be used to prevent dirty writes.
	 */
	etag?: string;
}

export interface IResolveFileOptions {
	resolveTo?: URI[];
	resolveSingleChildDescendants?: boolean;
}
572 573 574 575 576 577 578 579 580

export interface ICreateFileOptions {

	/**
	 * Overwrite the file to create if it already exists on disk. Otherwise
	 * an error will be thrown (FILE_MODIFIED_SINCE).
	 */
	overwrite?: boolean;
}
E
Erich Gamma 已提交
581 582 583 584 585 586

export interface IImportResult {
	stat: IFileStat;
	isNew: boolean;
}

587
export class FileOperationError extends Error {
588
	constructor(message: string, public fileOperationResult: FileOperationResult, public options?: IResolveContentOptions & IUpdateContentOptions & ICreateFileOptions) {
589 590
		super(message);
	}
B
Benjamin Pasero 已提交
591 592 593 594

	static isFileOperationError(obj: any): obj is FileOperationError {
		return obj instanceof Error && !isUndefinedOrNull((obj as FileOperationError).fileOperationResult);
	}
E
Erich Gamma 已提交
595 596 597 598 599 600 601 602 603 604
}

export enum FileOperationResult {
	FILE_IS_BINARY,
	FILE_IS_DIRECTORY,
	FILE_NOT_FOUND,
	FILE_NOT_MODIFIED_SINCE,
	FILE_MODIFIED_SINCE,
	FILE_MOVE_CONFLICT,
	FILE_READ_ONLY,
605
	FILE_PERMISSION_DENIED,
B
Benjamin Pasero 已提交
606 607
	FILE_TOO_LARGE,
	FILE_INVALID_PATH
E
Erich Gamma 已提交
608 609
}

610
export const AutoSaveConfiguration = {
611 612
	OFF: 'off',
	AFTER_DELAY: 'afterDelay',
613 614
	ON_FOCUS_CHANGE: 'onFocusChange',
	ON_WINDOW_CHANGE: 'onWindowChange'
B
Benjamin Pasero 已提交
615
};
616

617 618
export const HotExitConfiguration = {
	OFF: 'off',
D
Daniel Imms 已提交
619 620
	ON_EXIT: 'onExit',
	ON_EXIT_AND_WINDOW_CLOSE: 'onExitAndWindowClose'
621 622
};

623 624
export const CONTENT_CHANGE_EVENT_BUFFER_DELAY = 1000;

625
export const FILES_ASSOCIATIONS_CONFIG = 'files.associations';
626
export const FILES_EXCLUDE_CONFIG = 'files.exclude';
627

E
Erich Gamma 已提交
628 629
export interface IFilesConfiguration {
	files: {
630
		associations: { [filepattern: string]: string };
E
Erich Gamma 已提交
631
		exclude: glob.IExpression;
632
		watcherExclude: { [filepattern: string]: boolean };
E
Erich Gamma 已提交
633
		encoding: string;
634
		autoGuessEncoding: boolean;
635
		defaultLanguage: string;
E
Erich Gamma 已提交
636
		trimTrailingWhitespace: boolean;
637
		autoSave: string;
638
		autoSaveDelay: number;
639
		eol: string;
640
		hotExit: string;
641
		useExperimentalFileWatcher: boolean;
E
Erich Gamma 已提交
642
	};
643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733
}

export const SUPPORTED_ENCODINGS: { [encoding: string]: { labelLong: string; labelShort: string; order: number; encodeOnly?: boolean; alias?: string } } = {
	utf8: {
		labelLong: 'UTF-8',
		labelShort: 'UTF-8',
		order: 1,
		alias: 'utf8bom'
	},
	utf8bom: {
		labelLong: 'UTF-8 with BOM',
		labelShort: 'UTF-8 with BOM',
		encodeOnly: true,
		order: 2,
		alias: 'utf8'
	},
	utf16le: {
		labelLong: 'UTF-16 LE',
		labelShort: 'UTF-16 LE',
		order: 3
	},
	utf16be: {
		labelLong: 'UTF-16 BE',
		labelShort: 'UTF-16 BE',
		order: 4
	},
	windows1252: {
		labelLong: 'Western (Windows 1252)',
		labelShort: 'Windows 1252',
		order: 5
	},
	iso88591: {
		labelLong: 'Western (ISO 8859-1)',
		labelShort: 'ISO 8859-1',
		order: 6
	},
	iso88593: {
		labelLong: 'Western (ISO 8859-3)',
		labelShort: 'ISO 8859-3',
		order: 7
	},
	iso885915: {
		labelLong: 'Western (ISO 8859-15)',
		labelShort: 'ISO 8859-15',
		order: 8
	},
	macroman: {
		labelLong: 'Western (Mac Roman)',
		labelShort: 'Mac Roman',
		order: 9
	},
	cp437: {
		labelLong: 'DOS (CP 437)',
		labelShort: 'CP437',
		order: 10
	},
	windows1256: {
		labelLong: 'Arabic (Windows 1256)',
		labelShort: 'Windows 1256',
		order: 11
	},
	iso88596: {
		labelLong: 'Arabic (ISO 8859-6)',
		labelShort: 'ISO 8859-6',
		order: 12
	},
	windows1257: {
		labelLong: 'Baltic (Windows 1257)',
		labelShort: 'Windows 1257',
		order: 13
	},
	iso88594: {
		labelLong: 'Baltic (ISO 8859-4)',
		labelShort: 'ISO 8859-4',
		order: 14
	},
	iso885914: {
		labelLong: 'Celtic (ISO 8859-14)',
		labelShort: 'ISO 8859-14',
		order: 15
	},
	windows1250: {
		labelLong: 'Central European (Windows 1250)',
		labelShort: 'Windows 1250',
		order: 16
	},
	iso88592: {
		labelLong: 'Central European (ISO 8859-2)',
		labelShort: 'ISO 8859-2',
		order: 17
	},
734 735 736 737 738
	cp852: {
		labelLong: 'Central European (CP 852)',
		labelShort: 'CP 852',
		order: 18
	},
739 740 741
	windows1251: {
		labelLong: 'Cyrillic (Windows 1251)',
		labelShort: 'Windows 1251',
742
		order: 19
743 744 745 746
	},
	cp866: {
		labelLong: 'Cyrillic (CP 866)',
		labelShort: 'CP 866',
747
		order: 20
748 749 750 751
	},
	iso88595: {
		labelLong: 'Cyrillic (ISO 8859-5)',
		labelShort: 'ISO 8859-5',
752
		order: 21
753 754 755 756
	},
	koi8r: {
		labelLong: 'Cyrillic (KOI8-R)',
		labelShort: 'KOI8-R',
757
		order: 22
758 759 760 761
	},
	koi8u: {
		labelLong: 'Cyrillic (KOI8-U)',
		labelShort: 'KOI8-U',
762
		order: 23
763 764 765 766
	},
	iso885913: {
		labelLong: 'Estonian (ISO 8859-13)',
		labelShort: 'ISO 8859-13',
767
		order: 24
768 769 770 771
	},
	windows1253: {
		labelLong: 'Greek (Windows 1253)',
		labelShort: 'Windows 1253',
772
		order: 25
773 774 775 776
	},
	iso88597: {
		labelLong: 'Greek (ISO 8859-7)',
		labelShort: 'ISO 8859-7',
777
		order: 26
778 779 780 781
	},
	windows1255: {
		labelLong: 'Hebrew (Windows 1255)',
		labelShort: 'Windows 1255',
782
		order: 27
783 784 785 786
	},
	iso88598: {
		labelLong: 'Hebrew (ISO 8859-8)',
		labelShort: 'ISO 8859-8',
787
		order: 28
788 789 790 791
	},
	iso885910: {
		labelLong: 'Nordic (ISO 8859-10)',
		labelShort: 'ISO 8859-10',
792
		order: 29
793 794 795 796
	},
	iso885916: {
		labelLong: 'Romanian (ISO 8859-16)',
		labelShort: 'ISO 8859-16',
797
		order: 30
798 799 800 801
	},
	windows1254: {
		labelLong: 'Turkish (Windows 1254)',
		labelShort: 'Windows 1254',
802
		order: 31
803 804 805 806
	},
	iso88599: {
		labelLong: 'Turkish (ISO 8859-9)',
		labelShort: 'ISO 8859-9',
807
		order: 32
808 809 810 811
	},
	windows1258: {
		labelLong: 'Vietnamese (Windows 1258)',
		labelShort: 'Windows 1258',
812
		order: 33
813 814 815 816
	},
	gbk: {
		labelLong: 'Chinese (GBK)',
		labelShort: 'GBK',
817
		order: 34
818 819 820 821
	},
	gb18030: {
		labelLong: 'Chinese (GB18030)',
		labelShort: 'GB18030',
822
		order: 35
823 824 825 826
	},
	cp950: {
		labelLong: 'Traditional Chinese (Big5)',
		labelShort: 'Big5',
827
		order: 36
828 829 830 831
	},
	big5hkscs: {
		labelLong: 'Traditional Chinese (Big5-HKSCS)',
		labelShort: 'Big5-HKSCS',
832
		order: 37
833 834 835 836
	},
	shiftjis: {
		labelLong: 'Japanese (Shift JIS)',
		labelShort: 'Shift JIS',
837
		order: 38
838 839 840 841
	},
	eucjp: {
		labelLong: 'Japanese (EUC-JP)',
		labelShort: 'EUC-JP',
842
		order: 39
843 844 845 846
	},
	euckr: {
		labelLong: 'Korean (EUC-KR)',
		labelShort: 'EUC-KR',
847
		order: 40
848 849 850 851
	},
	windows874: {
		labelLong: 'Thai (Windows 874)',
		labelShort: 'Windows 874',
852 853 854
		order: 41
	},
	iso885911: {
855 856
		labelLong: 'Latin/Thai (ISO 8859-11)',
		labelShort: 'ISO 8859-11',
857
		order: 42
858
	},
K
katainaka0503 已提交
859
	koi8ru: {
860 861
		labelLong: 'Cyrillic (KOI8-RU)',
		labelShort: 'KOI8-RU',
862
		order: 43
863
	},
K
katainaka0503 已提交
864
	koi8t: {
865 866
		labelLong: 'Tajik (KOI8-T)',
		labelShort: 'KOI8-T',
867
		order: 44
868
	},
K
katainaka0503 已提交
869
	gb2312: {
870 871
		labelLong: 'Simplified Chinese (GB 2312)',
		labelShort: 'GB 2312',
872
		order: 45
873 874 875 876 877 878 879 880 881 882
	},
	cp865: {
		labelLong: 'Nordic DOS (CP 865)',
		labelShort: 'CP 865',
		order: 46
	},
	cp850: {
		labelLong: 'Western European DOS (CP 850)',
		labelShort: 'CP 850',
		order: 47
883
	}
884
};
885 886 887 888 889

export enum FileKind {
	FILE,
	FOLDER,
	ROOT_FOLDER
890
}