From 04e61434577d2b167176832edd72121787f2a2db Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Wed, 10 Feb 2016 19:02:06 +0100 Subject: Cleanups for PREFIX patch --- icetime/icetime.cc | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'icetime') diff --git a/icetime/icetime.cc b/icetime/icetime.cc index dc8c436..fd7c898 100644 --- a/icetime/icetime.cc +++ b/icetime/icetime.cc @@ -265,17 +265,11 @@ void read_config() void read_chipdb() { char buffer[1024]; - char path[1024]; - //-- If the PREFIX initial character is ~ expand it the - //-- home directory - if (strlen(PREFIX)>0 && PREFIX[0]=='~') - snprintf(path, 1024, "%s%s", getenv("HOME"), &PREFIX[1]); + if (PREFIX[0] == '~' && PREFIX[1] == '/') + snprintf(buffer, 1024, "%s%s/share/icebox/chipdb-%s.txt", getenv("HOME"), PREFIX+1, config_device.c_str()); else - snprintf(path, 1024, "%s", PREFIX); - - //-- Chipdb file with full path - snprintf(buffer, 1024, "%s/share/icebox/chipdb-%s.txt", path, config_device.c_str()); + snprintf(buffer, 1024, "%s/share/icebox/chipdb-%s.txt", PREFIX, config_device.c_str()); FILE *fdb = fopen(buffer, "r"); if (fdb == nullptr) { @@ -283,7 +277,6 @@ void read_chipdb() exit(1); } - std::string mode; int current_net = -1; int tile_x = -1, tile_y = -1; -- cgit v1.2.3