Skip to content

Commit 0187f10

Browse files
author
Richard Lyle
committed
* Added Watson/Getting Started menu item.
* Watson/API Reference menu item now searches for the API_REFERENCE in the data path of the project.
1 parent 733744b commit 0187f10

File tree

1 file changed

+25
-4
lines changed

1 file changed

+25
-4
lines changed

Editor/ConfigEditor.cs

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ class ConfigEditor : EditorWindow
3838
{
3939
#region Constants
4040
private const string BLUEMIX_REGISTRATION = "https://console.ng.bluemix.net/registration/";
41-
private const string API_REFERENCE = "/Watson/Editor/Help/WatsonUnitySDK.chm";
41+
private const string API_REFERENCE = "WatsonUnitySDK.chm";
42+
private const string README = "https://github.com/watson-developer-cloud/unity-sdk/blob/develop/readme.md";
4243

4344
private class ServiceSetup
4445
{
@@ -143,11 +144,31 @@ private static void SaveConfig()
143144
File.WriteAllText(Application.streamingAssetsPath + "/Config.json", Config.Instance.SaveConfig());
144145
}
145146

147+
private static string FindFile( string directory, string name )
148+
{
149+
foreach( var f in Directory.GetFiles( directory ) )
150+
if ( f.EndsWith( name ) )
151+
return f;
152+
153+
foreach( var d in Directory.GetDirectories( directory ) )
154+
{
155+
string found = FindFile( d, name );
156+
if ( found != null )
157+
return found;
158+
}
159+
160+
return null;
161+
}
162+
146163
[MenuItem("Watson/API Reference", false, 100 )]
147-
private static void ShowHelp()
164+
private static void ShowAPIReference()
165+
{
166+
Application.OpenURL( "file://" + FindFile( Application.dataPath, API_REFERENCE ) );
167+
}
168+
[MenuItem("Watson/Getting Started", false, 100 )]
169+
private static void ShowReadme()
148170
{
149-
string helpFile = "file://" + Application.dataPath + API_REFERENCE;
150-
Application.OpenURL( helpFile );
171+
Application.OpenURL( README );
151172
}
152173

153174
[MenuItem("Watson/Configuration Editor", false, 0 )]

0 commit comments

Comments
 (0)