1
0
mirror of synced 2025-12-21 19:06:49 -05:00

change path.join to path.posix.join for Windows friendliness

This commit is contained in:
Sarah Schneider
2021-01-19 14:47:45 -05:00
parent 4545ffd3e9
commit 02e95f583a
7 changed files with 47870 additions and 9 deletions

View File

@@ -67,7 +67,7 @@ function getNewVersionedPath (oldPath, languageCode = '') {
const restOfString = oldPath.replace(patterns.oldEnterprisePath, '') const restOfString = oldPath.replace(patterns.oldEnterprisePath, '')
// Add the language and new version to the product part of the string // Add the language and new version to the product part of the string
return path.join('/', languageCode, newVersion, restOfString) return path.posix.join('/', languageCode, newVersion, restOfString)
} }
module.exports = { module.exports = {

View File

@@ -15,7 +15,7 @@ class Permalink {
const permalinkSuffix = this.constructor.relativePathToSuffix(relativePath) const permalinkSuffix = this.constructor.relativePathToSuffix(relativePath)
this.href = removeFPTFromPath(path.join('/', languageCode, pageVersion, permalinkSuffix)) this.href = removeFPTFromPath(path.posix.join('/', languageCode, pageVersion, permalinkSuffix))
.replace(patterns.trailingSlash, '$1') .replace(patterns.trailingSlash, '$1')
this.pageVersionTitle = allVersions[pageVersion].versionTitle this.pageVersionTitle = allVersions[pageVersion].versionTitle

View File

@@ -74,7 +74,7 @@ module.exports = function getDocsPathFromDeveloperPath (oldDeveloperPath, allRed
// old developer routes that include 'enterprise-admin' should always redirect to enterprise server // old developer routes that include 'enterprise-admin' should always redirect to enterprise server
if (fragment && newPath.includes('/rest/reference/enterprise-admin') && !patterns.enterpriseServer.test(newPath)) { if (fragment && newPath.includes('/rest/reference/enterprise-admin') && !patterns.enterpriseServer.test(newPath)) {
newPath = path.join('/en', `enterprise-server@${latest}`, getPathWithoutLanguage(getPathWithoutVersion(newPath))) newPath = path.posix.join('/en', `enterprise-server@${latest}`, getPathWithoutLanguage(getPathWithoutVersion(newPath)))
} }
// show an error if the page to be redirected to doesn't exist // show an error if the page to be redirected to doesn't exist

View File

@@ -36,7 +36,7 @@ module.exports = function generateRedirectsForPermalinks (permalinks, redirectFr
} }
// get the old path for the current permalink version // get the old path for the current permalink version
let versionedFrontmatterOldPath = path.join('/', permalink.languageCode, getNewVersionedPath(frontmatterOldPath)) let versionedFrontmatterOldPath = path.posix.join('/', permalink.languageCode, getNewVersionedPath(frontmatterOldPath))
const versionFromPath = getVersionStringFromPath(versionedFrontmatterOldPath) const versionFromPath = getVersionStringFromPath(versionedFrontmatterOldPath)
versionedFrontmatterOldPath = removeFPTFromPath(versionedFrontmatterOldPath.replace(versionFromPath, permalink.pageVersion)) versionedFrontmatterOldPath = removeFPTFromPath(versionedFrontmatterOldPath.replace(versionFromPath, permalink.pageVersion))

File diff suppressed because it is too large Load Diff

View File

@@ -52,7 +52,7 @@ function getNewHref (link, languageCode, version) {
const hrefWithoutLang = getPathWithoutLanguage(href) const hrefWithoutLang = getPathWithoutLanguage(href)
// normalize any legacy links so they conform to new link structure // normalize any legacy links so they conform to new link structure
newHref = path.join('/', languageCode, getNewVersionedPath(hrefWithoutLang)) newHref = path.posix.join('/', languageCode, getNewVersionedPath(hrefWithoutLang))
// get the current version from the link // get the current version from the link
const versionFromHref = getVersionStringFromPath(newHref) const versionFromHref = getVersionStringFromPath(newHref)

View File

@@ -37,7 +37,7 @@ module.exports = async function buildSiteTree (pageMap, site, redirects) {
return return
} }
product.href = path.join('/', languageCode, item.href) product.href = path.posix.join('/', languageCode, item.href)
// find the product TOC page so we have access to the TOC items // find the product TOC page so we have access to the TOC items
const page = findPage(item.href, pageMap, redirects) const page = findPage(item.href, pageMap, redirects)
@@ -71,7 +71,7 @@ function buildCategoriesTree (tocItems, versionedProductHref, pageMap, redirects
tocItems.forEach(item => { tocItems.forEach(item => {
const category = {} const category = {}
category.href = path.join(versionedProductHref, item.href) category.href = path.posix.join(versionedProductHref, item.href)
// find the category TOC page and get its TOC items // find the category TOC page and get its TOC items
const page = findPage(category.href, pageMap, redirects) const page = findPage(category.href, pageMap, redirects)
@@ -115,7 +115,7 @@ function buildMaptopicsTree (tocItems, versionedCategoryHref, pageMap, redirects
.forEach(item => { .forEach(item => {
const maptopic = {} const maptopic = {}
maptopic.href = path.join(versionedCategoryHref, item.href) maptopic.href = path.posix.join(versionedCategoryHref, item.href)
// find the category TOC page and get its TOC items // find the category TOC page and get its TOC items
const page = findPage(maptopic.href, pageMap, redirects) const page = findPage(maptopic.href, pageMap, redirects)
@@ -150,7 +150,7 @@ function buildArticlesTree (tocItems, versionedCategoryHref, pageMap, redirects,
tocItems.forEach(item => { tocItems.forEach(item => {
const article = {} const article = {}
article.href = path.join(versionedCategoryHref, item.href) article.href = path.posix.join(versionedCategoryHref, item.href)
// find the category TOC page and get its TOC items // find the category TOC page and get its TOC items
const page = findPage(article.href, pageMap, redirects) const page = findPage(article.href, pageMap, redirects)