The JUCE cross-platform C++ framework, with DISTRHO/KXStudio specific changes
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

73 lines
2.7KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE 6 technical preview.
  4. Copyright (c) 2017 - ROLI Ltd.
  5. You may use this code under the terms of the GPL v3
  6. (see www.gnu.org/licenses).
  7. For this technical preview, this file is not subject to commercial licensing.
  8. JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
  9. EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
  10. DISCLAIMED.
  11. ==============================================================================
  12. */
  13. #pragma once
  14. //==============================================================================
  15. namespace FileHelpers
  16. {
  17. bool containsAnyNonHiddenFiles (const File& folder);
  18. bool shouldPathsBeRelative (String path1, String path2);
  19. // removes "/../" bits from the middle of the path
  20. String simplifyPath (String::CharPointerType path);
  21. String simplifyPath (const String& path);
  22. }
  23. //==============================================================================
  24. const char* const sourceFileExtensions = "cpp;mm;m;c;cc;cxx;swift;s;asm;r";
  25. const char* const headerFileExtensions = "h;hpp;hxx;hh;inl";
  26. const char* const cOrCppFileExtensions = "cpp;cc;cxx;c";
  27. const char* const cppFileExtensions = "cpp;cc;cxx";
  28. const char* const objCFileExtensions = "mm;m";
  29. const char* const asmFileExtensions = "s;S;asm";
  30. const char* const sourceOrHeaderFileExtensions = "cpp;mm;m;c;cc;cxx;swift;s;S;asm;h;hpp;hxx;hh;inl";
  31. const char* const browseableFileExtensions = "cpp;mm;m;c;cc;cxx;swift;s;S;asm;h;hpp;hxx;hh;inl;txt;md;rtf";
  32. const char* const fileTypesToCompileByDefault = "cpp;mm;c;m;cc;cxx;swift;s;S;asm;r";
  33. //==============================================================================
  34. struct FileModificationDetector
  35. {
  36. FileModificationDetector (const File& f) : file (f) {}
  37. const File& getFile() const { return file; }
  38. void fileHasBeenRenamed (const File& newFile) { file = newFile; }
  39. bool hasBeenModified() const
  40. {
  41. return fileModificationTime != file.getLastModificationTime()
  42. && (fileSize != file.getSize()
  43. || build_tools::calculateFileHashCode (file) != fileHashCode);
  44. }
  45. void updateHash()
  46. {
  47. fileModificationTime = file.getLastModificationTime();
  48. fileSize = file.getSize();
  49. fileHashCode = build_tools::calculateFileHashCode (file);
  50. }
  51. private:
  52. File file;
  53. Time fileModificationTime;
  54. uint64 fileHashCode = 0;
  55. int64 fileSize = -1;
  56. };