Skip to content

Commit

Permalink
cobaltians/Cobalt#154: rename cobalt.conf to json
Browse files Browse the repository at this point in the history
  • Loading branch information
Sébastien Vitard committed Apr 24, 2019
1 parent e410054 commit de5a9ae
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
8 changes: 4 additions & 4 deletions src/main/java/org/cobaltians/cobalt/Cobalt.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public class Cobalt {
* CONFIGURATION FILE
**********************************************************************************************/

private final static String CONF_FILE = "cobalt.conf";
public final static String CONF_FILE = "cobalt.json";
private final static String kControllers = "controllers";
private final static String kPlugins = "plugins";
private final static String kAndroid = "android";
Expand Down Expand Up @@ -422,7 +422,7 @@ public Bundle getConfigurationForController(String controller) {
return bundle;
}
catch (JSONException exception) {
if (Cobalt.DEBUG) Log.e(Cobalt.TAG, TAG + " - getConfigurationForController: check cobalt.conf. Known issues: \n "
if (Cobalt.DEBUG) Log.e(Cobalt.TAG, TAG + " - getConfigurationForController: check cobalt.json. Known issues: \n "
+ "\t - controllers field not found or not a JSONObject \n "
+ "\t - " + controller + " controller not found and no " + kDefaultController + " controller defined \n "
+ "\t - " + controller + " or " + kDefaultController + "controller found but no " + kAndroid + "defined \n ");
Expand Down Expand Up @@ -474,7 +474,7 @@ public HashMap<String, Class<? extends CobaltAbstractPlugin>> getPlugins() {
}
catch (JSONException exception) {
if (Cobalt.DEBUG) {
Log.w(Cobalt.TAG, TAG + " - getPlugins: plugins field of cobalt.conf not found or not a JSONObject.");
Log.w(Cobalt.TAG, TAG + " - getPlugins: plugins field of cobalt.json not found or not a JSONObject.");
exception.printStackTrace();
}
}
Expand Down Expand Up @@ -524,7 +524,7 @@ private JSONObject getConfiguration() {
sCobaltConfiguration = new JSONObject(configuration);
}
catch (JSONException exception) {
if (Cobalt.DEBUG) Log.e(Cobalt.TAG, TAG + " - getConfiguration: check cobalt.conf. File is missing or not at " + ASSETS_PATH + mResourcePath + CONF_FILE);
if (Cobalt.DEBUG) Log.e(Cobalt.TAG, TAG + " - getConfiguration: check cobalt.json. File is missing or not at " + ASSETS_PATH + mResourcePath + CONF_FILE);
exception.printStackTrace();
return new JSONObject();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,10 @@
public class CobaltFontManager {

/**
* the fonts key in cobalt.conf
* the fonts key in cobalt.json
*/
private static final String kFonts = "fonts";
private static final String kAndroid = "android";
private static final String CONF_FILE = "cobalt.conf";
private static Context mContext;
// TAG
public static final String TAG = CobaltFontManager.class.getSimpleName();
Expand Down Expand Up @@ -152,7 +151,7 @@ private static HashMap<String, Class<? extends CobaltAbstractFontDrawable>> getF
}
catch (JSONException e) {
if (Cobalt.DEBUG) {
Log.w(TAG, TAG + " - getFonts: fonts field of cobalt.conf not found or not a JSONObject.");
Log.w(TAG, TAG + " - getFonts: fonts field of cobalt.json not found or not a JSONObject.");
e.printStackTrace();
}
}
Expand All @@ -166,13 +165,13 @@ private static HashMap<String, Class<? extends CobaltAbstractFontDrawable>> getF
// TODO: remove
private static JSONObject getConfiguration() {
String mResourcePath = Cobalt.getInstance(mContext).getResourcePathFromAsset();
String configuration = readFileFromAssets( mResourcePath + CONF_FILE);
String configuration = readFileFromAssets( mResourcePath + Cobalt.CONF_FILE);

try {
return new JSONObject(configuration);
}
catch (JSONException exception) {
if (Cobalt.DEBUG) Log.e(TAG, TAG + " - getConfiguration: check cobalt.conf. File is missing or not at " + mResourcePath + CONF_FILE);
if (Cobalt.DEBUG) Log.e(TAG, TAG + " - getConfiguration: check cobalt.json. File is missing or not at " + mResourcePath + Cobalt.CONF_FILE);
exception.printStackTrace();
}

Expand Down

0 comments on commit de5a9ae

Please sign in to comment.