Code refactoring.
Added files with functions for various OS (//go:build windows, //go:build !windows).
This commit is contained in:
		@@ -9,7 +9,6 @@ import (
 | 
			
		||||
	"fyne.io/fyne/v2/widget"
 | 
			
		||||
	"io"
 | 
			
		||||
	"regexp"
 | 
			
		||||
	"runtime"
 | 
			
		||||
	"strconv"
 | 
			
		||||
	"strings"
 | 
			
		||||
)
 | 
			
		||||
@@ -69,12 +68,7 @@ func (h ConvertorHandler) checkingFFPathUtilities() bool {
 | 
			
		||||
		return true
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	var pathsToFF []convertor.FFPathUtilities
 | 
			
		||||
	if runtime.GOOS == "windows" {
 | 
			
		||||
		pathsToFF = []convertor.FFPathUtilities{{"ffmpeg\\bin\\ffmpeg.exe", "ffmpeg\\bin\\ffprobe.exe"}}
 | 
			
		||||
	} else {
 | 
			
		||||
		pathsToFF = []convertor.FFPathUtilities{{"ffmpeg/bin/ffmpeg", "ffmpeg/bin/ffprobe"}, {"ffmpeg", "ffprobe"}}
 | 
			
		||||
	}
 | 
			
		||||
	pathsToFF := getPathsToFF()
 | 
			
		||||
	for _, item := range pathsToFF {
 | 
			
		||||
		ffmpegChecking, _ := h.convertorService.ChangeFFmpegPath(item.FFmpeg)
 | 
			
		||||
		if ffmpegChecking == false {
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										10
									
								
								src/handler/convertor_anyos.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								src/handler/convertor_anyos.go
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,10 @@
 | 
			
		||||
//go:build !windows
 | 
			
		||||
// +build !windows
 | 
			
		||||
 | 
			
		||||
package handler
 | 
			
		||||
 | 
			
		||||
import "ffmpegGui/convertor"
 | 
			
		||||
 | 
			
		||||
func getPathsToFF() []convertor.FFPathUtilities {
 | 
			
		||||
	return []convertor.FFPathUtilities{{"ffmpeg/bin/ffmpeg", "ffmpeg/bin/ffprobe"}, {"ffmpeg", "ffprobe"}}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										8
									
								
								src/handler/convertor_windows.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								src/handler/convertor_windows.go
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,8 @@
 | 
			
		||||
//go:build windows
 | 
			
		||||
// +build windows
 | 
			
		||||
 | 
			
		||||
package handler
 | 
			
		||||
 | 
			
		||||
func getPathsToFF() []convertor.FFPathUtilities {
 | 
			
		||||
	return []convertor.FFPathUtilities{{"ffmpeg\\bin\\ffmpeg.exe", "ffmpeg\\bin\\ffprobe.exe"}}
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user