Cleanups for PREFIX patch

This commit is contained in:
Clifford Wolf 2016-02-10 19:02:06 +01:00
parent 873baf773a
commit 04e6143457
1 changed files with 3 additions and 10 deletions

View File

@ -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;