Fix rule partial path on production

parent a2d5fc9b
......@@ -398,8 +398,10 @@ class Blockdown
parsedFilePath = (path.parse file)
# console.log(parsedFilePath)
# On development, the cache folder is at /users/<name>/better.fyi/.private/cache/…
# In production, it is accessed via /app/better.fyi/.private/cache/…
# So choose the start index of the file path accordingly.
indexToStartFrom = if app.isRunningInProduction then 4 else 5
filePathKey = path.join parsedFilePath.dir.split('/')[indexToStartFrom..].join('/'), parsedFilePath.base
# console.log(filePathKey)
......@@ -849,7 +851,12 @@ Better is a Safari content blocker for <a href='https://itunes.apple.com/us/app/
# Determine where to store the partial rule (used in caching so that we
# can create the blocker list without having to render every rule every time).
parsedPathOfOriginalFile = path.parse pathOfOriginalFile
partialRuleFileRelativePath = parsedPathOfOriginalFile.dir.split('/')[5..].join('/')
# On development, the cache folder is at /users/<name>/better.fyi/.private/cache/…
# In production, it is accessed via /app/better.fyi/.private/cache/…
# So choose the start index of the file path accordingly.
indexToStartFrom = if app.isRunningInProduction then 4 else 5
partialRuleFileRelativePath = parsedPathOfOriginalFile.dir.split('/')[indexToStartFrom..].join('/')
partialRuleFilePath = path.join app.rulePartialsDirectory, partialRuleFileRelativePath
fs.ensureDirSync partialRuleFilePath
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment