Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Path is converted to windows style when opening with external editor in win #15096

Merged
merged 3 commits into from
Mar 19, 2020
Merged

Path is converted to windows style when opening with external editor in win #15096

merged 3 commits into from
Mar 19, 2020

Conversation

niteskum
Copy link
Collaborator

@niteskum niteskum commented Mar 19, 2020

some Applications like Illustrator can not open file represented in Posix style. so converting path to windows style for windows platform.

@sobisht @narayani28 @jha-G please review.

@niteskum niteskum changed the title Path is converted to windows style when opening with external editor Path is converted to windows style when opening with external editor in win Mar 19, 2020
@@ -48,9 +48,16 @@ define(function (require, exports, module) {

var extensionToExtApplicationMap = {};

function convertUnixPathToWindowsPath(path) {
if (brackets.platform === "win") {
path = path.split("/").join("\\");
Copy link
Contributor

@g-217 g-217 Mar 19, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should write

path = path.replace(/\//g, '\\');

Also since we are converting path to Windows, should we ensure first char is a drive letter?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

path = path.replace(///g, '\'); this don't work , tried it.

Other suggestion to check first char is a drive done,

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check this:
FileSystem.isAbsolutePath = function (fullPath) {
return (fullPath[0] === "/" || (fullPath[1] === ":" && fullPath[2] === "/"));
};

Copy link
Contributor

@g-217 g-217 Mar 19, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also checked, and this is working:

'C:/Users/gjha/Desktop/test.js'.replace(/\//g, '\\')
"C:\Users\gjha\Desktop\test.js"
'C:/Users/gjha/Desktop/test.js'.replace(RegExp('/','g'), '\\')
"C:\Users\gjha\Desktop\test.js"

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jha-G made changes as above info.

@niteskum niteskum merged commit b4abc5a into adobe:master Mar 19, 2020
niteskum added a commit that referenced this pull request Mar 24, 2020
Path is converted to windows style when opening with external editor in win
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants