Skip to content

Commit

Permalink
Merge pull request #3 from iMi-digital/fix/relative-to-absolute-file-…
Browse files Browse the repository at this point in the history
…path-conversion

fix: early return if path is already absolute
  • Loading branch information
peterjaap committed Mar 25, 2022
2 parents d9d7a45 + 1c702c0 commit 2c7fe08
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/components/OverrideSelector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,8 @@ export default {
}
this.methodName = methodName;
this.copyPasteableFilePath = customFilePath.replace("data/", "");
customFilePath = this.fixPath(customFilePath);
this.copyPasteableFilePath = this.getRelativePath(customFilePath);
customFilePath = this.getAbsolutePath(customFilePath);
this.customFileType = customFilePath.split(".").pop();
if (this.customFileType === "phtml") {
this.customFileType = "php";
Expand All @@ -241,12 +241,15 @@ export default {
//
// }, 100);
},
fixPath(path) {
if (path.indexOf("/data/") > -1) {
path = path.split("magento2/")[1];
getAbsolutePath(path) {
if (path.indexOf(this.selectedMagento2ProjectDir) > -1) {
return path;
}
return this.selectedMagento2ProjectDir + "/" + path;
},
getRelativePath(path) {
return path.replace(this.selectedMagento2ProjectDir + "/", "");
},
},
};
</script>

0 comments on commit 2c7fe08

Please sign in to comment.