@@ -52,12 +52,7 @@ function Test-ForDependencies {
5252 throw " 7zip not command available. Please follow the instructions above."
5353 }
5454
55- if ($IsWindows ) {
56- $isCurlAvailable = Get-Command curl.exe
57- }
58- else {
59- $isCurlAvailable = Get-Command curl
60- }
55+ $isCurlAvailable = Get-Command $curl
6156
6257 if (-not $isCurlAvailable ) {
6358 Clear-Host
@@ -69,7 +64,7 @@ function Test-ForDependencies {
6964 Write-Host
7065 Write-Host " When you're done, rerun this script.`n "
7166
72- throw " curl or curl.exe command not available. Please follow the instructions above."
67+ throw " curl not available. Please follow the instructions above."
7368 }
7469}
7570
@@ -242,26 +237,15 @@ function Push-ClientFiles {
242237 Write-Host " Uploading client files to https://minecraft.curseforge.com/api/projects/$CURSEFORGE_PROJECT_ID /upload-file" - ForegroundColor Green
243238 Write-Host
244239
245- if ($IsWindows ) {
246- $response = curl.exe `
247- -- url " https://minecraft.curseforge.com/api/projects/$CURSEFORGE_PROJECT_ID /upload-file" `
248- -- user " $CURSEFORGE_USER `:$CURSEFORGE_TOKEN " `
249- - H " Accept: application/json" `
250- - H X- Api- Token:$CURSEFORGE_TOKEN `
251- -F metadata= $CLIENT_METADATA `
252- -F file= @" $CLIENT_ZIP_NAME .zip" `
253- -- progress- bar | ConvertFrom-Json
254- }
255- else {
256- $response = curl `
257- -- url " https://minecraft.curseforge.com/api/projects/$CURSEFORGE_PROJECT_ID /upload-file" `
258- -- user " $CURSEFORGE_USER `:$CURSEFORGE_TOKEN " `
259- - H " Accept: application/json" `
260- - H X- Api- Token:$CURSEFORGE_TOKEN `
261- -F metadata= $CLIENT_METADATA `
262- -F file= @" $CLIENT_ZIP_NAME .zip" `
263- -- progress- bar | ConvertFrom-Json
264- }
240+ $response = & $curl `
241+ -- url " https://minecraft.curseforge.com/api/projects/$CURSEFORGE_PROJECT_ID /upload-file" `
242+ -- user " $CURSEFORGE_USER `:$CURSEFORGE_TOKEN " `
243+ - H " Accept: application/json" `
244+ - H X- Api- Token:$CURSEFORGE_TOKEN `
245+ -F metadata= $CLIENT_METADATA `
246+ -F file= @" $CLIENT_ZIP_NAME .zip" `
247+ -- progress- bar | ConvertFrom-Json
248+
265249
266250 $clientFileReturnId = $response.id
267251
@@ -345,27 +329,14 @@ function Push-ServerFiles {
345329 Write-Host " Uploading server files..." - ForegroundColor Cyan
346330 Write-Host
347331
348- if ($IsWindows ) {
349-
350- $serverFileResponse = curl.exe `
351- -- url " https://minecraft.curseforge.com/api/projects/$CURSEFORGE_PROJECT_ID /upload-file" `
352- -- user " $CURSEFORGE_USER `:$CURSEFORGE_TOKEN " `
353- - H " Accept: application/json" `
354- - H X- Api- Token:$CURSEFORGE_TOKEN `
355- -F metadata= $SERVER_METADATA `
356- -F file= @$serverFilePath `
357- -- progress- bar | ConvertFrom-Json
358- }
359- else {
360- $serverFileResponse = curl `
361- -- url " https://minecraft.curseforge.com/api/projects/$CURSEFORGE_PROJECT_ID /upload-file" `
362- -- user " $CURSEFORGE_USER `:$CURSEFORGE_TOKEN " `
363- - H " Accept: application/json" `
364- - H X- Api- Token:$CURSEFORGE_TOKEN `
365- -F metadata= $SERVER_METADATA `
366- -F file= @$serverFilePath `
367- -- progress- bar | ConvertFrom-Json
368- }
332+ $serverFileResponse = & $curl `
333+ -- url " https://minecraft.curseforge.com/api/projects/$CURSEFORGE_PROJECT_ID /upload-file" `
334+ -- user " $CURSEFORGE_USER `:$CURSEFORGE_TOKEN " `
335+ - H " Accept: application/json" `
336+ - H X- Api- Token:$CURSEFORGE_TOKEN `
337+ -F metadata= $SERVER_METADATA `
338+ -F file= @$serverFilePath `
339+ -- progress- bar | ConvertFrom-Json
369340
370341 if ($serverFileResponse.errorCode ) {
371342 throw " Failed to upload server files: $serverFileResponse "
@@ -433,10 +404,10 @@ Set-Location $INSTANCE_ROOT
433404
434405if ($null -eq $IsWindows -or $IsWindows ) {
435406 # The script is running on Windows, use curl.exe
436- $IsWindows = $true
407+ $curl = " curl.exe "
437408}
438409else {
439- $IsWindows = $false
410+ $curl = " curl "
440411}
441412
442413Test-ForDependencies
0 commit comments