Skip to content

Commit 2fdb3e8

Browse files
macOS is case-insensitive
1 parent 0198d8f commit 2fdb3e8

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

src/features/ExtensionCommands.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -390,8 +390,8 @@ export class ExtensionCommandsFeature implements IFeature {
390390

391391
// since Windows is case-insensitive, we need to normalize it differently
392392
var canFind = vscode.workspace.textDocuments.find(doc => {
393-
var docPath;
394-
if (os.platform() == "win32") {
393+
var docPath, platform = os.platform();
394+
if (platform == "win32" || platform == "darwin") {
395395
// for windows paths, they are normalized to be lowercase
396396
docPath = doc.fileName.toLowerCase();
397397
} else {
@@ -424,8 +424,8 @@ export class ExtensionCommandsFeature implements IFeature {
424424

425425
// since Windows is case-insensitive, we need to normalize it differently
426426
var canFind = vscode.workspace.textDocuments.find(doc => {
427-
var docPath;
428-
if (os.platform() == "win32") {
427+
var docPath, platform = os.platform();
428+
if (platform == "win32" || platform == "darwin") {
429429
// for windows paths, they are normalized to be lowercase
430430
docPath = doc.fileName.toLowerCase();
431431
} else {
@@ -454,7 +454,8 @@ export class ExtensionCommandsFeature implements IFeature {
454454
}
455455

456456
private normalizeFilePath(filePath: string): string {
457-
if (os.platform() == "win32") {
457+
var platform = os.platform();
458+
if (platform == "win32") {
458459
// Make sure the file path is absolute
459460
if (!path.win32.isAbsolute(filePath))
460461
{
@@ -474,7 +475,12 @@ export class ExtensionCommandsFeature implements IFeature {
474475
filePath);
475476
}
476477

477-
return filePath;
478+
//macOS is case-insensitive
479+
if (platform == "darwin") {
480+
filePath = filePath.toLowerCase();
481+
}
482+
483+
return filePath;
478484
}
479485
}
480486

0 commit comments

Comments
 (0)