Browse Source

Fix windows build, cleanup

tags/1.9.8
falkTX 8 years ago
parent
commit
79d2686147
7 changed files with 19 additions and 79 deletions
  1. +5
    -38
      source/modules/water/files/File.cpp
  2. +2
    -34
      source/modules/water/files/File.h
  3. +4
    -0
      source/modules/water/misc/Time.cpp
  4. +3
    -2
      source/modules/water/water.cpp
  5. +1
    -1
      source/native-plugins/Makefile
  6. +1
    -2
      source/utils/CarlaBinaryUtils.hpp
  7. +3
    -2
      source/utils/CarlaPipeUtils.cpp

+ 5
- 38
source/modules/water/files/File.cpp View File

@@ -34,7 +34,9 @@
#include "CarlaJuceUtils.hpp"
#ifndef CARLA_OS_WIN
#ifdef CARLA_OS_WIN
# include <shlobj.h>
#else
# include <dlfcn.h>
# include <fcntl.h>
# include <pwd.h>
@@ -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:


+ 2
- 34
source/modules/water/files/File.h View File

@@ -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


+ 4
- 0
source/modules/water/misc/Time.cpp View File

@@ -28,6 +28,10 @@
#include <ctime>
#include <sys/time.h>
#ifdef CARLA_OS_WIN
# include <mmsystem.h>
#endif
namespace water {
namespace TimeHelpers


+ 3
- 2
source/modules/water/water.cpp View File

@@ -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);


+ 1
- 1
source/native-plugins/Makefile View File

@@ -72,7 +72,7 @@ $(MODULEDIR)/$(MODULENAME).a: $(OBJS)
-@mkdir -p $(MODULEDIR)
@echo "Creating $(MODULENAME).a"
@rm -f $@
$(AR) crs $@ $^
@$(AR) crs $@ $^

# ---------------------------------------------------------------------------------------------------------------------



+ 1
- 2
source/utils/CarlaBinaryUtils.hpp View File

@@ -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 <magic.h>
#endif


+ 3
- 2
source/utils/CarlaPipeUtils.cpp View File

@@ -1,6 +1,6 @@
/*
* Carla Pipe Utilities
* Copyright (C) 2013-2016 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2013-2017 Filipe Coelho <falktx@falktx.com>
*
* 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 <fcntl.h>

#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 <cerrno>
# include <signal.h>


Loading…
Cancel
Save