Skip to content

Commit

Permalink
Don't try to find or parse a draw.ini file on Fuchsia (issue #55).
Browse files Browse the repository at this point in the history
  • Loading branch information
bkonyi committed Apr 13, 2018
1 parent f3182a7 commit 23be316
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions lib/src/draw_config_context.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
/// Use of this source code is governed by a BSD-style license that
/// can be found in the LICENSE file.
import 'dart:io';

import 'package:ini/ini.dart';

import 'config_file_reader.dart';
Expand Down Expand Up @@ -179,19 +181,24 @@ class DRAWConfigContext {
_checkForUpdates =
checkForUpdates == null ? null : _configBool(checkForUpdates);

final configFileReader = new ConfigFileReader(_configUrl);
// TODO(bkonyi): Issue #55 - support draw.ini configs on Fuchsia.
if (Platform.isFuchsia) {
final configFileReader = new ConfigFileReader(_configUrl);

// Load the first file found in order of path preference.
final primaryFile = configFileReader.loadCorrectFile();
if (primaryFile != null) {
try {
_customConfig = new Config.fromStrings(primaryFile.readAsLinesSync());
} catch (exception) {
throw new DRAWClientError('Could not parse configuration file.');
// Load the first file found in order of path preference.
final primaryFile = configFileReader.loadCorrectFile();
if (primaryFile != null) {
try {
_customConfig = new Config.fromStrings(primaryFile.readAsLinesSync());
} catch (exception) {
throw new DRAWClientError('Could not parse configuration file.');
}
}
} else {
_customConfig = new Config();
}

// Create an empty config if we can't find the config or we're on Fuchsia.
_customConfig ??= new Config();

// Load values found in the ini file, into the object fields.
fieldMap.forEach((key, value) => _fieldInitializer(key, value));
}
Expand Down

0 comments on commit 23be316

Please sign in to comment.