Browse Source

Added utility to convert all files to Mac line endings

master
Christopher 8 years ago
parent
commit
8f71e11880
  1. 2
      Assets/Fungus/Thirdparty/FungusLua/Thirdparty/JSON/readme.txt
  2. 9
      Assets/Fungus/Thirdparty/LineEndings.meta
  3. 9
      Assets/Fungus/Thirdparty/LineEndings/Editor.meta
  4. 159
      Assets/Fungus/Thirdparty/LineEndings/Editor/LineEndingsEditMenu.cs
  5. 10
      Assets/Fungus/Thirdparty/LineEndings/Editor/LineEndingsEditMenu.cs.meta
  6. 2
      Assets/Fungus/Thirdparty/Reorderable List Field/LICENSE.txt
  7. 2
      Assets/Fungus/Thirdparty/Reorderable List Field/README.txt
  8. 2
      Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/Batch.cs
  9. 12
      Assets/UnityTestTools/LICENSE.txt
  10. 2
      Assets/UnityTestTools/changelog.txt

2
Assets/Fungus/Thirdparty/FungusLua/Thirdparty/JSON/readme.txt vendored

@ -1,4 +1,4 @@
==Author== ==Author==
[mailto:schoen@defectivestudios.com Matt Schoen] of [http://www.defectivestudios.com Defective Studios] [mailto:schoen@defectivestudios.com Matt Schoen] of [http://www.defectivestudios.com Defective Studios]
==Download== ==Download==

9
Assets/Fungus/Thirdparty/LineEndings.meta vendored

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 1b39a7374cafc4d698bac382a6ec8092
folderAsset: yes
timeCreated: 1488287629
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

9
Assets/Fungus/Thirdparty/LineEndings/Editor.meta vendored

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 246e827fcb2f2445fab551623bf99ba3
folderAsset: yes
timeCreated: 1481645890
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

159
Assets/Fungus/Thirdparty/LineEndings/Editor/LineEndingsEditMenu.cs vendored

@ -0,0 +1,159 @@
//-----------------------------------------------------------------------
// <summary>
// Unity Editor tool that formats line endings to be consistent.
// </summary>
// <copyright file="LineEndingsEditMenu.cs" company="Tiaan.com">
// Copyright (c) 2014 Tiaan Geldenhuys
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
// restriction, including without limitation the rights to use,
// copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
//-----------------------------------------------------------------------
namespace TiaanDotCom.Unity3D.EditorTools
{
using System.Collections.Generic;
using System.IO;
using System.Text.RegularExpressions;
using UnityEditor;
using UnityEngine;
/// <summary>
/// Implements menu items for the Unity Editor to perform
/// end-of-line conversion and fix issues such as for the
/// following: "There are inconsistent line endings in the
/// 'Assets/.../*.cs' script. Some are Mac OS X (UNIX) and
/// some are Windows. This might lead to incorrect line
/// numbers in stacktraces and compiler errors."
/// </summary>
public static class LineEndingsEditMenu
{
// [MenuItem("Tools/Fungus/Utilities/EOL Conversion (Windows)")]
// public static void ConvertLineEndingsToWindowsFormat()
// {
// ConvertLineEndings(false);
// }
[MenuItem("Tools/Fungus/Utilities/Convert to Mac Line Endings")]
public static void ConvertLineEndingsToMacFormat()
{
ConvertLineEndings(true);
}
private static void ConvertLineEndings(bool isUnixFormat)
{
string title = string.Format(
"EOL Conversion to {0} Format",
(isUnixFormat ? "UNIX" : "Windows"));
if (!EditorUtility.DisplayDialog(
title,
"This operation may potentially modify " +
"many files in the current project! " +
"Hopefully you have backups of everything. " +
"Are you sure you want to proceed?",
"Yes",
"No"))
{
Debug.Log("EOL Conversion was not attempted.");
return;
}
var fileTypes = new string[]
{
"*.txt",
"*.cs",
"*.js",
"*.boo",
"*.compute",
"*.shader",
"*.cginc",
"*.glsl",
"*.xml",
"*.xaml",
"*.json",
"*.inc",
"*.css",
"*.htm",
"*.html",
};
string projectAssetsPath = Application.dataPath;
int totalFileCount = 0;
var changedFiles = new List<string>();
var regex = new Regex(@"(?<!\r)\n");
const string LineEnd = "\r\n";
var comparisonType = System.StringComparison.Ordinal;
foreach (string fileType in fileTypes)
{
string[] filenames = Directory.GetFiles(
projectAssetsPath,
fileType,
SearchOption.AllDirectories);
totalFileCount += filenames.Length;
foreach (string filename in filenames)
{
string originalText = File.ReadAllText(filename);
string changedText;
changedText = regex.Replace(originalText, LineEnd);
if (isUnixFormat)
{
changedText =
changedText.Replace(LineEnd, "\n");
}
bool isTextIdentical = string.Equals(
changedText, originalText, comparisonType);
if (!isTextIdentical)
{
changedFiles.Add(filename);
File.WriteAllText(
filename,
changedText,
System.Text.Encoding.UTF8);
}
}
}
int changedFileCount = changedFiles.Count;
int skippedFileCount = (totalFileCount - changedFileCount);
string message = string.Format(
"EOL Conversion skipped {0} " +
"files and changed {1} files",
skippedFileCount,
changedFileCount);
if (changedFileCount <= 0)
{
message += ".";
}
else
{
message += (":" + LineEnd);
message += string.Join(LineEnd, changedFiles.ToArray());
}
Debug.Log(message);
if (changedFileCount > 0)
{
// Recompile modified scripts.
AssetDatabase.Refresh();
}
}
}
}

10
Assets/Fungus/Thirdparty/LineEndings/Editor/LineEndingsEditMenu.cs.meta vendored

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 71f72aa69e779c946beeee31eb72d4d3
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

2
Assets/Fungus/Thirdparty/Reorderable List Field/LICENSE.txt vendored

@ -1,4 +1,4 @@
The MIT License (MIT) The MIT License (MIT)
Copyright (c) 2013-2015 Rotorz Limited Copyright (c) 2013-2015 Rotorz Limited

2
Assets/Fungus/Thirdparty/Reorderable List Field/README.txt vendored

@ -1,4 +1,4 @@
README README
====== ======
List control for Unity allowing editor developers to add reorderable list controls to List control for Unity allowing editor developers to add reorderable list controls to

2
Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/Editor/Batch.cs

@ -1,4 +1,4 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;

12
Assets/UnityTestTools/LICENSE.txt

@ -1,9 +1,9 @@
This software is provided 'as-is', without any express or implied warranty. This software is provided 'as-is', without any express or implied warranty.
THE UNITY TEST TOOLS CONTAIN THE FOLLOWING THIRD PARTY LIBRARIES: THE UNITY TEST TOOLS CONTAIN THE FOLLOWING THIRD PARTY LIBRARIES:
NSubstitute Copyright (c) 2009 Anthony Egerton (nsubstitute@delfish.com) and David Tchepak (dave@davesquared.net). All rights reserved. NSubstitute Copyright (c) 2009 Anthony Egerton (nsubstitute@delfish.com) and David Tchepak (dave@davesquared.net). All rights reserved.
NUnit Portions Copyright © 2002-2009 Charlie Poole or Copyright © 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov or Copyright © 2000-2002 Philip A. Craig NUnit Portions Copyright <EFBFBD> 2002-2009 Charlie Poole or Copyright <EFBFBD> 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov or Copyright <EFBFBD> 2000-2002 Philip A. Craig
Cecil Copyright (c) 2008 - 2011, Jb Evain Cecil Copyright (c) 2008 - 2011, Jb Evain
@ -42,9 +42,9 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
NUnit is provided 'as-is', without any express or implied warranty. The modifications made by Unity are available on github. NUnit is provided 'as-is', without any express or implied warranty. The modifications made by Unity are available on github.
Copyright © 2002-2013 Charlie Poole Copyright <EFBFBD> 2002-2013 Charlie Poole
Copyright © 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov Copyright <EFBFBD> 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
Copyright © 2000-2002 Philip A. Craig Copyright <EFBFBD> 2000-2002 Philip A. Craig
This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.
@ -52,7 +52,7 @@ Permission is granted to anyone to use this software for any purpose, including
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment (see the following) in the product documentation is required. 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment (see the following) in the product documentation is required.
Portions Copyright © 2002-2013 Charlie Poole or Copyright © 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov or Copyright © 2000-2002 Philip A. Craig Portions Copyright <EFBFBD> 2002-2013 Charlie Poole or Copyright <EFBFBD> 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov or Copyright <EFBFBD> 2000-2002 Philip A. Craig
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.

2
Assets/UnityTestTools/changelog.txt

@ -1,4 +1,4 @@
Version 1.5.9 Version 1.5.9
- Updated tools for Unity 5.4 - Updated tools for Unity 5.4
- Bugfixes - Bugfixes

Loading…
Cancel
Save