Extracted out shortcut extension constant

This commit is contained in:
Dustin Brett
2021-06-12 21:59:42 -07:00
parent d83968b2a2
commit 0eee42e648
2 changed files with 4 additions and 2 deletions

View File

@@ -6,7 +6,7 @@ import { useFileSystem } from 'contexts/fileSystem';
import ini from 'ini';
import { extname } from 'path';
import { useEffect, useState } from 'react';
import { IMAGE_FILE_EXTENSIONS } from 'utils/constants';
import { IMAGE_FILE_EXTENSIONS, SHORTCUT_EXTENSION } from 'utils/constants';
import { bufferToUrl } from 'utils/functions';
type FileInfo = {
@@ -45,7 +45,7 @@ const useFileInfo = (path: string): FileInfo => {
url: path
});
if (extension === '.url') {
if (extension === SHORTCUT_EXTENSION) {
fs.readFile(path, (error, contents = Buffer.from('')) => {
if (error) {
getInfoByFileExtension();

View File

@@ -41,4 +41,6 @@ export const MILLISECONDS_IN_SECOND = 1000;
export const PROCESS_DELIMITER = '__';
export const SHORTCUT_EXTENSION = '.url';
export const WINDOW_TRANSITION_DURATION_IN_MILLISECONDS = 250;