function getClonedLocFilePath()

in scripts/generateTemplates.js [411:439]


function getClonedLocFilePath(templatePath, rootDirectory, fileType, fileName) {
    var result = rootDirectory;
    if (rootDirectory.endsWith("\\")) {
        result = result.substring(0, result.length - 1);
    }
    result = result.concat("\\out\\loc\\", LangOutputSpecifier, "\\output\\loc")
    var removedIndex = templatePath.replace(rootDirectory, "");
    if (!result.endsWith("\\")) {
        result = result.concat("\\");
    }
    if (removedIndex.startsWith("\\")) {
        removedIndex = removedIndex.substring(1);
    }

    if (fileType === WorkbookFileType.Gallery) {
        if (removedIndex.endsWith("\\")) {
            removedIndex = removedIndex.concat(fileName.substring(0, fileName.lastIndexOf('.')));
        } else {
            removedIndex = removedIndex.concat("\\", fileName.substring(0, fileName.lastIndexOf('.')));
        }
    } else {
        if (removedIndex.startsWith("Workbooks\\")) {
            removedIndex = removedIndex.replace("Workbooks\\", "");
        } else if (removedIndex.startsWith("Cohorts\\")) {
            removedIndex = removedIndex.replace("Cohorts\\", "");
        }
    }
    return result.concat(removedIndex, RESJSONFileExtension);
}