diff --git a/source/modules/water/files/File.cpp b/source/modules/water/files/File.cpp index 093f027b9..2f8984828 100644 --- a/source/modules/water/files/File.cpp +++ b/source/modules/water/files/File.cpp @@ -34,7 +34,9 @@ #include "CarlaJuceUtils.hpp" -#ifndef CARLA_OS_WIN +#ifdef CARLA_OS_WIN +# include +#else # include # include # include @@ -1119,20 +1121,11 @@ File File::getSpecialLocation (const SpecialLocationType type) return File (String (dest)); } - case windowsSystemDirectory: - { - CHAR dest [2048]; - dest[0] = 0; - GetSystemDirectory (dest, (UINT) numElementsInArray (dest)); - return File (String (dest)); - } - case currentExecutableFile: - case currentApplicationFile: - return WindowsFileHelpers::getModuleFileName ((HINSTANCE) Process::getCurrentModuleInstanceHandle()); + return WindowsFileHelpers::getModuleFileName (water_getCurrentModuleInstanceHandle()); case hostApplicationPath: - return WindowsFileHelpers::getModuleFileName (0); + return WindowsFileHelpers::getModuleFileName (nullptr); default: jassertfalse; // unknown type? @@ -1429,8 +1422,6 @@ File File::getSpecialLocation (const SpecialLocationType type) switch (type) { case userHomeDirectory: resultPath = nsStringToWater (NSHomeDirectory()); break; - case userDocumentsDirectory: resultPath = "~/Documents"; break; - case userDesktopDirectory: resultPath = "~/Desktop"; break; case tempDirectory: { @@ -1439,32 +1430,9 @@ File File::getSpecialLocation (const SpecialLocationType type) return File (tmp.getFullPathName()); } - case userMusicDirectory: resultPath = "~/Music"; break; - case userMoviesDirectory: resultPath = "~/Movies"; break; - case userPicturesDirectory: resultPath = "~/Pictures"; break; - case userApplicationDataDirectory: resultPath = "~/Library"; break; - case commonApplicationDataDirectory: resultPath = "/Library"; break; - case commonDocumentsDirectory: resultPath = "/Users/Shared"; break; - case globalApplicationsDirectory: resultPath = "/Applications"; break; - - case invokedExecutableFile: - if (water_argv != nullptr && water_argc > 0) - return File::getCurrentWorkingDirectory().getChildFile (CharPointer_UTF8 (water_argv[0])); - // deliberate fall-through... - case currentExecutableFile: return water_getExecutableFile(); - case currentApplicationFile: - { - const File exe (water_getExecutableFile()); - const File parent (exe.getParentDirectory()); - - return parent.getFullPathName().endsWithIgnoreCase ("Contents/MacOS") - ? parent.getParentDirectory().getParentDirectory() - : exe; - } - case hostApplicationPath: { unsigned int size = 8192; @@ -1624,7 +1592,6 @@ File File::getSpecialLocation (const SpecialLocationType type) } case currentExecutableFile: - case currentApplicationFile: return water_getExecutableFile(); case hostApplicationPath: diff --git a/source/modules/water/files/File.h b/source/modules/water/files/File.h index d34a1f334..de174c5b4 100644 --- a/source/modules/water/files/File.h +++ b/source/modules/water/files/File.h @@ -713,13 +713,6 @@ public: /** The user's home folder. This is the same as using File ("~"). */ userHomeDirectory, - /** A place to put documents which are shared by all users of the machine. - On Windows this may be somewhere like "C:\Users\Public\Documents", on OSX it - will be something like "/Users/Shared". Other OSes may have no such concept - though, so be careful. - */ - commonDocumentsDirectory, - /** The folder that should be used for temporary files. Always delete them when you're finished, to keep the user's computer tidy! */ @@ -730,37 +723,12 @@ public: If running as a plug-in or DLL, this will (where possible) be the DLL rather than the host app. - On the mac this will return the unix binary, not the package folder - see - currentApplicationFile for that. - - See also invokedExecutableFile, which is similar, but if the exe was launched from a - file link, invokedExecutableFile will return the name of the link. + On the mac this will return the unix binary, not the package folder. */ currentExecutableFile, - /** Returns this application's location. - - If running as a plug-in or DLL, this will (where possible) be the DLL rather than the - host app. - - On the mac this will return the package folder (if it's in one), not the unix binary - that's inside it - compare with currentExecutableFile. - */ - currentApplicationFile, - /** In a plugin, this will return the path of the host executable. */ - hostApplicationPath, - - #ifdef CARLA_OS_WIN - /** On a Windows machine, returns the location of the Windows/System32 folder. */ - windowsSystemDirectory, - #endif - - /** The directory in which applications normally get installed. - So on windows, this would be something like "c:\program files", on the - Mac "/Applications", or "/usr" on linux. - */ - globalApplicationsDirectory + hostApplicationPath }; /** Finds the location of a special type of file or directory, such as a home folder or diff --git a/source/modules/water/misc/Time.cpp b/source/modules/water/misc/Time.cpp index 53e6b65d9..b19021c52 100644 --- a/source/modules/water/misc/Time.cpp +++ b/source/modules/water/misc/Time.cpp @@ -28,6 +28,10 @@ #include #include +#ifdef CARLA_OS_WIN +# include +#endif + namespace water { namespace TimeHelpers diff --git a/source/modules/water/water.cpp b/source/modules/water/water.cpp index 026b774f2..f37516cab 100644 --- a/source/modules/water/water.cpp +++ b/source/modules/water/water.cpp @@ -16,6 +16,7 @@ * For a full copy of the GNU General Public License see the doc/GPL.txt file. */ +#include "maths/MathsFunctions.h" #include "misc/Result.h" //============================================================================== @@ -42,9 +43,9 @@ static int64 water_fileSetPosition (void* handle, int64 pos) return li.QuadPart; } -static void* currentModuleHandle = nullptr; +static HINSTANCE currentModuleHandle = nullptr; -void* Process::getCurrentModuleInstanceHandle() noexcept +HINSTANCE water_getCurrentModuleInstanceHandle() noexcept { if (currentModuleHandle == nullptr) currentModuleHandle = GetModuleHandleA (nullptr); diff --git a/source/native-plugins/Makefile b/source/native-plugins/Makefile index 0bcdd264a..75a532bac 100644 --- a/source/native-plugins/Makefile +++ b/source/native-plugins/Makefile @@ -72,7 +72,7 @@ $(MODULEDIR)/$(MODULENAME).a: $(OBJS) -@mkdir -p $(MODULEDIR) @echo "Creating $(MODULENAME).a" @rm -f $@ - $(AR) crs $@ $^ + @$(AR) crs $@ $^ # --------------------------------------------------------------------------------------------------------------------- diff --git a/source/utils/CarlaBinaryUtils.hpp b/source/utils/CarlaBinaryUtils.hpp index 2f49d8fa4..45b75902c 100644 --- a/source/utils/CarlaBinaryUtils.hpp +++ b/source/utils/CarlaBinaryUtils.hpp @@ -22,8 +22,7 @@ #include "CarlaUtils.hpp" #if defined(CARLA_OS_WIN) -# include "CarlaJuceUtils.hpp" -# include "water/water.h" +# include "water/files/FileInputStream.h" #elif defined(HAVE_LIBMAGIC) # include #endif diff --git a/source/utils/CarlaPipeUtils.cpp b/source/utils/CarlaPipeUtils.cpp index 3299241ce..396cc4e1c 100644 --- a/source/utils/CarlaPipeUtils.cpp +++ b/source/utils/CarlaPipeUtils.cpp @@ -1,6 +1,6 @@ /* * Carla Pipe Utilities - * Copyright (C) 2013-2016 Filipe Coelho + * Copyright (C) 2013-2017 Filipe Coelho * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -36,7 +36,8 @@ #include #if defined(CARLA_OS_MAC) || defined(CARLA_OS_WIN) -# include "water/water.h" +# include "water/misc/Time.h" +# include "water/text/String.h" #else # include # include