|
@@ -321,7 +321,7 @@ export async function checkIfClientExists(id: string): Promise<ConnectedSocketCl
|
|
|
// Check if the file exists
|
|
|
let filePath = process.env.FolderPath as string + 'clients.json'
|
|
|
if (!fs.existsSync(filePath)) {
|
|
|
- console.log({ message: "File does not exist." })
|
|
|
+ console.log({ message: `File does not exist.` })
|
|
|
reject('File does not exist');
|
|
|
}
|
|
|
|
|
@@ -349,10 +349,10 @@ export async function checkIfClientExists(id: string): Promise<ConnectedSocketCl
|
|
|
export async function checkOwnClientInfo(filename?: string): Promise<{ id: string }> {
|
|
|
return new Promise((resolve, reject) => {
|
|
|
// Check if the file exists
|
|
|
- if (fs.existsSync(`${filename}.json`)) {
|
|
|
+ let filePath = process.env.FolderPath as string
|
|
|
+ if (fs.existsSync(`${filePath}${filename}.json`)) {
|
|
|
try {
|
|
|
// Read the file contents
|
|
|
- let filePath = process.env.FolderPath as string
|
|
|
const fileData = fs.readFileSync(filePath + `${filename}.json`, 'utf8');
|
|
|
|
|
|
// If the file is empty, return an error
|
|
@@ -370,7 +370,7 @@ export async function checkOwnClientInfo(filename?: string): Promise<{ id: strin
|
|
|
reject('');
|
|
|
}
|
|
|
} else {
|
|
|
- console.log({ message: "File does not exist" })
|
|
|
+ console.log({ message: `File does not exist. Id: ${filename}` })
|
|
|
reject('');
|
|
|
}
|
|
|
})
|