fix import
This commit is contained in:
@ -140,7 +140,7 @@ const FileTreeItem = ({
|
||||
async (eventType, path) => {
|
||||
// Don't try to read a file that was removed.
|
||||
if (isCurrentFile && eventType !== 'unlink') {
|
||||
let code = await window.electron.readFile(path)
|
||||
let code = await window.electron.readFile(path, 'utf-8')
|
||||
code = normalizeLineEndings(code)
|
||||
codeManager.updateCodeStateEditor(code)
|
||||
}
|
||||
|
||||
@ -28,8 +28,9 @@ class FileSystemManager {
|
||||
)
|
||||
}
|
||||
|
||||
return this.join(this.dir, path).then((filePath) => {
|
||||
return window.electron.readFile(filePath)
|
||||
return this.join(this.dir, path).then(async (filePath) => {
|
||||
const content = await window.electron.readFile(filePath)
|
||||
return content
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@ -448,7 +448,7 @@ export const readProjectSettingsFile = async (
|
||||
}
|
||||
}
|
||||
|
||||
const configToml = await window.electron.readFile(settingsPath)
|
||||
const configToml = await window.electron.readFile(settingsPath, 'utf-8')
|
||||
const configObj = parseProjectSettings(configToml)
|
||||
if (err(configObj)) {
|
||||
return Promise.reject(configObj)
|
||||
@ -467,7 +467,7 @@ export const readAppSettingsFile = async () => {
|
||||
|
||||
// The file exists, read it and parse it.
|
||||
if (window.electron.exists(settingsPath)) {
|
||||
const configToml = await window.electron.readFile(settingsPath)
|
||||
const configToml = await window.electron.readFile(settingsPath, 'utf-8')
|
||||
const parsedAppConfig = parseAppSettings(configToml)
|
||||
if (err(parsedAppConfig)) {
|
||||
return Promise.reject(parsedAppConfig)
|
||||
@ -527,7 +527,7 @@ export const readTokenFile = async () => {
|
||||
let settingsPath = await getTokenFilePath()
|
||||
|
||||
if (window.electron.exists(settingsPath)) {
|
||||
const token: string = await window.electron.readFile(settingsPath)
|
||||
const token: string = await window.electron.readFile(settingsPath, 'utf-8')
|
||||
if (!token) return ''
|
||||
|
||||
return token
|
||||
|
||||
@ -109,7 +109,7 @@ export const fileLoader: LoaderFunction = async (
|
||||
)
|
||||
}
|
||||
|
||||
code = await window.electron.readFile(currentFilePath)
|
||||
code = await window.electron.readFile(currentFilePath, 'utf-8')
|
||||
code = normalizeLineEndings(code)
|
||||
|
||||
// Update both the state and the editor's code.
|
||||
|
||||
@ -73,7 +73,7 @@ const watchFileOff = (path: string, key: string) => {
|
||||
fsWatchListeners.set(path, watchers)
|
||||
}
|
||||
}
|
||||
const readFile = (path: string) => fs.readFile(path, 'utf-8')
|
||||
const readFile = (path: string, as?: string) => fs.readFile(path, as)
|
||||
// It seems like from the node source code this does not actually block but also
|
||||
// don't trust me on that (jess).
|
||||
const exists = (path: string) => fsSync.existsSync(path)
|
||||
|
||||
Reference in New Issue
Block a user