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.

80 lines
2.9KB

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