File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22 getModulePath ,
33 getOS ,
44 getOSName ,
5- getPath ,
65 getTemporalUpdateFilePathname ,
76} from "../utils/main.ts" ;
87import { OS } from "../enums/main.ts" ;
@@ -106,7 +105,7 @@ export const update = async ({
106105
107106 log ( `[${ label } ] Update files downloaded!` ) ;
108107 const dirPath = getModulePath ( "" ) ;
109- const updateFilePath = getModulePath ( getTemporalUpdateFilePathname ( ) ) ;
108+ const updateFilePath = getTemporalUpdateFilePathname ( ) ;
110109 const updateFile = path . join ( dirPath , `update_${ osAsset . name } ` ) ;
111110 const updatedFile = path . join ( dirPath , osAsset . name ) ;
112111
Original file line number Diff line number Diff line change @@ -3,5 +3,11 @@ import * as path from "@std/path";
33export const getExecPath = ( ) : string => Deno . execPath ( ) ;
44export const getPath = ( ) : string => path . dirname ( getExecPath ( ) ) ;
55
6- export const getModulePath = ( filePath : string = "" ) : string =>
7- path . join ( path . dirname ( path . fromFileUrl ( Deno . mainModule ) ) , filePath ) ;
6+ export const getModulePath = ( filePath : string = "" ) : string => {
7+ // If running uncompiled (`deno run main.ts`), use Deno.mainModule
8+ const root = Deno . mainModule . startsWith ( "file:" )
9+ ? path . dirname ( path . fromFileUrl ( Deno . mainModule ) )
10+ : path . dirname ( getExecPath ( ) ) ;
11+
12+ return path . join ( root , filePath ) ;
13+ } ;
You can’t perform that action at this time.
0 commit comments