HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers10/shop.komma.nl/node_modules/@vue/cli-ui/apollo-server/connectors/cwd.js
const channels = require('../channels')
const fs = require('fs')
const path = require('path')

let cwd = process.cwd()

function normalize (value) {
  if (value.length === 1) return value
  const lastChar = value.charAt(value.length - 1)
  if (lastChar === path.sep) {
    value = value.substr(0, value.length - 1)
  }
  return value
}

module.exports = {
  get: () => cwd,
  set: (value, context) => {
    value = normalize(value)
    if (!fs.existsSync(value)) return
    cwd = value
    process.env.VUE_CLI_CONTEXT = value
    context.pubsub.publish(channels.CWD_CHANGED, { cwdChanged: value })
    try {
      process.chdir(value)
    } catch (err) {}
  }
}