@@ -48,6 +48,7 @@ function makeLoader(id: string, binaryName: string) {
48
48
49
49
interface InstallerMeta {
50
50
repositoryId : string ;
51
+ binName : string ;
51
52
lookupLimit ?: number ;
52
53
isWrappedDir ?: boolean ; // Wether archive contains files wrapped in a single directory
53
54
}
@@ -68,15 +69,15 @@ function makeInstaller(id: string, meta: InstallerMeta) {
68
69
/**
69
70
* Usage:
70
71
* ```
71
- * await installRelease('realesrgan', 'windows', utils);
72
- * await installRelease('realesrgan', 'macos', utils);
73
- * await installRelease('realesrgan', 'ubuntu|linux', utils);
72
+ * await installRelease('realesrgan', 'windows', meta, utils);
73
+ * await installRelease('realesrgan', 'macos', meta, utils);
74
+ * await installRelease('realesrgan', 'ubuntu|linux', meta, utils);
74
75
* ```
75
76
*/
76
77
async function installRelease (
77
78
id : string ,
78
79
archiveSuffix : string ,
79
- { repositoryId, lookupLimit = 10 , isWrappedDir} : InstallerMeta ,
80
+ { repositoryId, binName , lookupLimit = 10 , isWrappedDir} : InstallerMeta ,
80
81
{ dataPath, tmpPath, download, extract, fetchJson, cleanup, progress, stage, log} : InstallUtils
81
82
) {
82
83
const dependencyDirectory = Path . join ( dataPath , id ) ;
@@ -174,6 +175,11 @@ async function installRelease(
174
175
await FSP . rename ( fromPath , toPath ) ;
175
176
}
176
177
178
+ stage ( `ensuring binaries are executable` ) ;
179
+ const binPath = Path . join ( dependencyDirectory , binName ) ;
180
+ log ( `marking as executable: ${ binPath } ` ) ;
181
+ await FSP . chmod ( binPath , 0o755 ) ;
182
+
177
183
/**
178
184
* We need to write down the version manually, because the binary has no
179
185
* API to describe itself.
@@ -905,14 +911,20 @@ const acceptsFlags = makeAcceptsFlags<Options>()({
905
911
export type Payload = PayloadData < Options , typeof acceptsFlags > ;
906
912
907
913
export default ( plugin : Plugin ) => {
914
+ const waifu2xBinName = `waifu2x-ncnn-vulkan${ process . platform === 'win32' ? '.exe' : '' } ` ;
908
915
plugin . registerDependency ( 'waifu2x' , {
909
- load : makeLoader ( 'waifu2x' , `waifu2x-ncnn-vulkan${ process . platform === 'win32' ? '.exe' : '' } ` ) ,
910
- install : makeInstaller ( 'waifu2x' , { repositoryId : 'nihui/waifu2x-ncnn-vulkan' , isWrappedDir : true } ) ,
916
+ load : makeLoader ( 'waifu2x' , waifu2xBinName ) ,
917
+ install : makeInstaller ( 'waifu2x' , {
918
+ repositoryId : 'nihui/waifu2x-ncnn-vulkan' ,
919
+ binName : waifu2xBinName ,
920
+ isWrappedDir : true ,
921
+ } ) ,
911
922
} ) ;
912
923
924
+ const esrganBinName = `realesrgan-ncnn-vulkan${ process . platform === 'win32' ? '.exe' : '' } ` ;
913
925
plugin . registerDependency ( 'realesrgan' , {
914
- load : makeLoader ( 'realesrgan' , `realesrgan-ncnn-vulkan ${ process . platform === 'win32' ? '.exe' : '' } ` ) ,
915
- install : makeInstaller ( 'realesrgan' , { repositoryId : 'xinntao/Real-ESRGAN' } ) ,
926
+ load : makeLoader ( 'realesrgan' , esrganBinName ) ,
927
+ install : makeInstaller ( 'realesrgan' , { repositoryId : 'xinntao/Real-ESRGAN' , binName : esrganBinName } ) ,
916
928
} ) ;
917
929
918
930
plugin . registerProcessor < Payload > ( 'upscale' , {
0 commit comments