From 7aebfe54421eb69f8fa9750f5638b9f229c75ef1 Mon Sep 17 00:00:00 2001 From: lukeIam Date: Sat, 28 Feb 2015 18:44:25 +0100 Subject: [PATCH 1/6] Removed unused usings from CGamePad --- Vocaluxe/Lib/Input/CGamePad.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/Vocaluxe/Lib/Input/CGamePad.cs b/Vocaluxe/Lib/Input/CGamePad.cs index 4e0ecca4..482dce1a 100644 --- a/Vocaluxe/Lib/Input/CGamePad.cs +++ b/Vocaluxe/Lib/Input/CGamePad.cs @@ -16,8 +16,6 @@ #endregion using System; -using System.Diagnostics.PerformanceData; -using System.Drawing; using System.Threading; using System.Windows.Forms; using OpenTK.Input; From 1b86baa24d00595a71a06750b9549a72c473ba6b Mon Sep 17 00:00:00 2001 From: derivator Date: Sun, 1 Mar 2015 00:34:00 +0100 Subject: [PATCH 2/6] Linux: build for x86 if we're on x86 --- Vocaluxe/Lib/Input/CHIDAPI.cs | 2 +- Vocaluxe/Lib/Video/Acinerella/CAcinerella.cs | 2 +- makefile | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Vocaluxe/Lib/Input/CHIDAPI.cs b/Vocaluxe/Lib/Input/CHIDAPI.cs index 7c761f8d..881beae3 100644 --- a/Vocaluxe/Lib/Input/CHIDAPI.cs +++ b/Vocaluxe/Lib/Input/CHIDAPI.cs @@ -47,7 +47,7 @@ namespace Vocaluxe.Lib.Input #endif #if LINUX - private const string _HIDApiDll = "libhidapi.so"; + private const string _HIDApiDll = "libhidapi-libusb.so"; #endif #endif diff --git a/Vocaluxe/Lib/Video/Acinerella/CAcinerella.cs b/Vocaluxe/Lib/Video/Acinerella/CAcinerella.cs index a93f1b71..6df32553 100644 --- a/Vocaluxe/Lib/Video/Acinerella/CAcinerella.cs +++ b/Vocaluxe/Lib/Video/Acinerella/CAcinerella.cs @@ -176,7 +176,7 @@ namespace Vocaluxe.Lib.Video.Acinerella #endif #if LINUX - private const string _AcDll = "x86/libacinerella.so"; + private const string _AcDll = "libacinerella.so"; #endif #endif diff --git a/makefile b/makefile index d366dbe6..7f17fb92 100644 --- a/makefile +++ b/makefile @@ -1,9 +1,10 @@ +ARCH?=$(shell uname -m | sed -e s/i.86/x86/ -e s/x86_64/x64/) windowsLibs = Output/gstreamer-sharp.dll Output/glib-sharp.dll all: $(MAKE) -C PitchTracker $(MAKE) -C Vocaluxe/Lib/Video/Acinerella rm -f $(windowsLibs) - xbuild /property:Platform=x64 /property:Configuration=ReleaseLinux + xbuild /property:Platform=$(ARCH) /property:Configuration=ReleaseLinux clean: xbuild /target:Clean From acd89bc2d3701a012b88f2f9e3e318105f27d5d3 Mon Sep 17 00:00:00 2001 From: derivator Date: Sun, 1 Mar 2015 02:14:01 +0100 Subject: [PATCH 3/6] Linux: store config in ~/.config/Vocaluxe instead of in install dir because we might not have permission to write there if installed as a package If that folder doesn't exist, create it and copy the default profiles there, so they show up but can still be edited or removed --- Vocaluxe/Base/CSettings.cs | 2 ++ Vocaluxe/CProgrammHelper.cs | 20 ++++++++++++++++++++ Vocaluxe/Program.cs | 3 ++- 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/Vocaluxe/Base/CSettings.cs b/Vocaluxe/Base/CSettings.cs index 0063a2e6..25aa2cd4 100644 --- a/Vocaluxe/Base/CSettings.cs +++ b/Vocaluxe/Base/CSettings.cs @@ -75,6 +75,8 @@ namespace Vocaluxe.Base #if INSTALLER public static readonly string DataFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "Vocaluxe"); +#elif LINUX + public static readonly string DataFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Vocaluxe"); #else public static readonly string DataFolder = ProgramFolder; #endif diff --git a/Vocaluxe/CProgrammHelper.cs b/Vocaluxe/CProgrammHelper.cs index 9f342c90..d25b138e 100644 --- a/Vocaluxe/CProgrammHelper.cs +++ b/Vocaluxe/CProgrammHelper.cs @@ -96,6 +96,23 @@ namespace Vocaluxe return _IsProgramInstalled("Microsoft Visual C++ 2010"); } + private static void _EnsureDataFolderExists() + { + if (!Directory.Exists(CSettings.DataFolder)) { + Directory.CreateDirectory(CSettings.DataFolder); + // copy default profiles to DataFolder instead of adding ProgramFolder to CConfig.ProfileFolders + // because we want to be able to edit them, but might not have permission to write to ProgramFolder + string profilePath = Path.Combine(CSettings.DataFolder, CSettings.FolderNameProfiles); + Directory.CreateDirectory(profilePath); + DirectoryInfo defaultProfileDir = new DirectoryInfo(Path.Combine(CSettings.ProgramFolder, CSettings.FolderNameProfiles)); + FileInfo[] files = defaultProfileDir.GetFiles(); + foreach (FileInfo file in files) { + string newPath = Path.Combine(profilePath, file.Name); + file.CopyTo(newPath, false); + } + } + } + public static bool CheckRequirements() { #if WIN @@ -135,6 +152,9 @@ namespace Vocaluxe #endif path = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location) + Path.DirectorySeparatorChar + path; COSFunctions.AddEnvironmentPath(path); +#if LINUX + _EnsureDataFolderExists(); +#endif } } } \ No newline at end of file diff --git a/Vocaluxe/Program.cs b/Vocaluxe/Program.cs index 6bac885c..43964170 100644 --- a/Vocaluxe/Program.cs +++ b/Vocaluxe/Program.cs @@ -85,11 +85,12 @@ namespace Vocaluxe { // Init Log CLog.Init(); - CLog.StartBenchmark("Init Program"); + if (!CProgrammHelper.CheckRequirements()) return; CProgrammHelper.Init(); + CLog.StartBenchmark("Init Program"); CMain.Init(); Application.DoEvents(); From 0f11a800f8ca98d75210c6278f84c9704c5df0b4 Mon Sep 17 00:00:00 2001 From: lukeIam Date: Wed, 4 Mar 2015 21:26:51 +0100 Subject: [PATCH 4/6] Fixed PS script for version injection into main.js --- Vocaluxe/Vocaluxe.csproj | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Vocaluxe/Vocaluxe.csproj b/Vocaluxe/Vocaluxe.csproj index a0990475..85b12678 100644 --- a/Vocaluxe/Vocaluxe.csproj +++ b/Vocaluxe/Vocaluxe.csproj @@ -536,10 +536,10 @@ - xcopy /E /D /Y "$(ProjectDir)\Website" "$(SolutionDir)\PhoneGap" -powershell -command "$version = git describe --long; (Get-Content -Encoding UTF8 '$(ProjectDir)..\Output\Website\js\main.js') | Foreach-Object {$_ -replace '(?<=var *matchingServerVersion * = *\\\")\w*(?=\\\" *;)', %2524('@(VersionNumber)'+' ('+$version+')')} | Set-Content -Encoding UTF8 '$(ProjectDir)..\Output\Website\js\main.js'" + xcopy /E /D /Y "$(ProjectDir)\Website" "$(SolutionDir)\PhoneGap" +powershell -command "$version = git describe --long; (Get-Content -Encoding UTF8 '$(ProjectDir)..\Output\Website\js\main.js') | Foreach-Object {$_ -replace '(?<=var *matchingServerVersion * = *\")\w*(?=\" *;)', "$version"} | Set-Content -Encoding UTF8 '$(ProjectDir)..\Output\Website\js\main.js'" powershell -command "(Get-Content -Encoding UTF8 '$(ProjectDir)Properties\AssemblyInfo.cs') | Foreach-Object {$_ -replace '(?<=AssemblyInformationalVersion\()(.*)(?=\))', '\"GITVERSION\"'} | Set-Content -Encoding UTF8 '$(ProjectDir)Properties\AssemblyInfo.cs'" - cp -ruT "$(ProjectDir)Website" "$(SolutionDir)/PhoneGap" + cp -ruT "$(ProjectDir)Website" "$(SolutionDir)/PhoneGap" powershell -command "$version = git describe --long; (Get-Content -Encoding UTF8 '$(ProjectDir)Properties\AssemblyInfo.cs') | Foreach-Object {$_ -replace 'GITVERSION', $version} | Set-Content -Encoding UTF8 '$(ProjectDir)Properties\AssemblyInfo.cs'" From d7e0b24eec694611e4c3a74ac04657ffbf434b22 Mon Sep 17 00:00:00 2001 From: derivator Date: Sun, 1 Mar 2015 16:48:39 +0100 Subject: [PATCH 5/6] Linux: set AssemblyInformationalVersion to git version during build just as windows builds do. Also set matchingServerVersion for the web app and use the new format in CVocaluxeServer. --- Vocaluxe/Base/Server/CVocaluxeServer.cs | 7 +------ Vocaluxe/Linux/Build/PostBuildEvent.sh | 5 +++++ Vocaluxe/Linux/Build/PreBuildEvent.sh | 4 ++++ Vocaluxe/Vocaluxe.csproj | 4 +++- 4 files changed, 13 insertions(+), 7 deletions(-) create mode 100755 Vocaluxe/Linux/Build/PostBuildEvent.sh create mode 100755 Vocaluxe/Linux/Build/PreBuildEvent.sh diff --git a/Vocaluxe/Base/Server/CVocaluxeServer.cs b/Vocaluxe/Base/Server/CVocaluxeServer.cs index 62b1d14e..138df11f 100644 --- a/Vocaluxe/Base/Server/CVocaluxeServer.cs +++ b/Vocaluxe/Base/Server/CVocaluxeServer.cs @@ -598,12 +598,7 @@ namespace Vocaluxe.Base.Server public static string GetServerVersion() { - var informationalVersion = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyInformationalVersionAttribute), false).FirstOrDefault(); - if (informationalVersion != null) - { - informationalVersion = ""; - } - return Assembly.GetExecutingAssembly().GetName().Version.ToString() + " (" + informationalVersion + ")"; + return Application.ProductVersion; } public static CBase64Image GetDelayedImage(string hashedFilename) diff --git a/Vocaluxe/Linux/Build/PostBuildEvent.sh b/Vocaluxe/Linux/Build/PostBuildEvent.sh new file mode 100755 index 00000000..c9c2d125 --- /dev/null +++ b/Vocaluxe/Linux/Build/PostBuildEvent.sh @@ -0,0 +1,5 @@ +#!/bin/sh +PROJECT=$1 +cd $PROJECT +sed -i -r -e 's/AssemblyInformationalVersion\(".*?"\)/AssemblyInformationalVersion("GITVERSION")/' $PROJECT/Properties/AssemblyInfo.cs +sed -i -e 's/var matchingServerVersion = "";/var matchingServerVersion = "'$(git describe --long)'";/' $PROJECT/../Output/Website/js/main.js diff --git a/Vocaluxe/Linux/Build/PreBuildEvent.sh b/Vocaluxe/Linux/Build/PreBuildEvent.sh new file mode 100755 index 00000000..4d7c6ef7 --- /dev/null +++ b/Vocaluxe/Linux/Build/PreBuildEvent.sh @@ -0,0 +1,4 @@ +#!/bin/sh +PROJECT=$1 +cd $PROJECT +sed -i -e s/GITVERSION/$(git describe --long)/ $PROJECT/Properties/AssemblyInfo.cs diff --git a/Vocaluxe/Vocaluxe.csproj b/Vocaluxe/Vocaluxe.csproj index 85b12678..bc340b00 100644 --- a/Vocaluxe/Vocaluxe.csproj +++ b/Vocaluxe/Vocaluxe.csproj @@ -539,10 +539,12 @@ xcopy /E /D /Y "$(ProjectDir)\Website" "$(SolutionDir)\PhoneGap" powershell -command "$version = git describe --long; (Get-Content -Encoding UTF8 '$(ProjectDir)..\Output\Website\js\main.js') | Foreach-Object {$_ -replace '(?<=var *matchingServerVersion * = *\")\w*(?=\" *;)', "$version"} | Set-Content -Encoding UTF8 '$(ProjectDir)..\Output\Website\js\main.js'" powershell -command "(Get-Content -Encoding UTF8 '$(ProjectDir)Properties\AssemblyInfo.cs') | Foreach-Object {$_ -replace '(?<=AssemblyInformationalVersion\()(.*)(?=\))', '\"GITVERSION\"'} | Set-Content -Encoding UTF8 '$(ProjectDir)Properties\AssemblyInfo.cs'" - cp -ruT "$(ProjectDir)Website" "$(SolutionDir)/PhoneGap" + cp -ruT "$(ProjectDir)Website" "$(SolutionDir)/PhoneGap" + $(ProjectDir)Linux/Build/PostBuildEvent.sh $(ProjectDir) powershell -command "$version = git describe --long; (Get-Content -Encoding UTF8 '$(ProjectDir)Properties\AssemblyInfo.cs') | Foreach-Object {$_ -replace 'GITVERSION', $version} | Set-Content -Encoding UTF8 '$(ProjectDir)Properties\AssemblyInfo.cs'" + $(ProjectDir)Linux/Build/PreBuildEvent.sh $(ProjectDir)