Browse Source

Introjucer: avoid an assertion when opening certain types of file

tags/2021-05-28
jules 9 years ago
parent
commit
e3d827a059
1 changed files with 3 additions and 2 deletions
  1. +3
    -2
      extras/Introjucer/Source/Utility/jucer_MiscUtilities.cpp

+ 3
- 2
extras/Introjucer/Source/Utility/jucer_MiscUtilities.cpp View File

@@ -269,11 +269,12 @@ bool fileNeedsCppSyntaxHighlighting (const File& file)
return true;
// This is a bit of a bodge to deal with libc++ headers with no extension..
char fileStart[64] = { 0 };
char fileStart[128] = { 0 };
FileInputStream fin (file);
fin.read (fileStart, sizeof (fileStart) - 4);
return String (fileStart).trimStart().startsWith ("// -*- C++ -*-");
return CharPointer_UTF8::isValidString (fileStart, sizeof (fileStart))
&& String (fileStart).trimStart().startsWith ("// -*- C++ -*-");
}
//==============================================================================


Loading…
Cancel
Save