From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pierre Neidhardt Subject: bug#29686: gnu: aspell: Do not ignore GuixOS system profile. Date: Sat, 26 Oct 2019 13:02:34 +0200 Message-ID: <87k18rahx1.fsf@ambrevar.xyz> References: <87k193r09v.fsf@ambrevar.xyz> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:33461) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iOJqd-0007Ii-6p for bug-guix@gnu.org; Sat, 26 Oct 2019 07:03:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iOJqb-0002Kb-Nm for bug-guix@gnu.org; Sat, 26 Oct 2019 07:03:07 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:59162) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iOJqY-0002K3-IP for bug-guix@gnu.org; Sat, 26 Oct 2019 07:03:05 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iOJqY-0008RT-Dc for bug-guix@gnu.org; Sat, 26 Oct 2019 07:03:02 -0400 Sender: "Debbugs-submit" Resent-Message-ID: In-Reply-To: <87k193r09v.fsf@ambrevar.xyz> List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: "bug-Guix" To: 29686@debbugs.gnu.org --=-=-= Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" --==-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable I just noticed that Nix has a different, possibly better approach to this in the attached patch. What do you think? =2D-=20 Pierre Neidhardt https://ambrevar.xyz/ --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEUPM+LlsMPZAEJKvom9z0l6S7zH8FAl20J8oACgkQm9z0l6S7 zH8WCwgAr49FbqIQj+am7Lr+DLCrjm0YrSSRIv9wb/7fhvSDsdHlvJ+2EXFM1qCo br2/AQXqwGfdVmIcAnoJ7B0VU90dHeFUWsX6A0WArxM9cyIreRlS/LGrlY09P65h iNeWir4qP8FhGbJtgi175HYkVw8i7TBphv9iG2ulzvlB9RLpq3hbpyBHMf6dQK7u K3NMfBZUwClmVDIdtIGoAhRz4woS7PRHZh/B2158sxDbo1oBrHZ4D19d+oK5ak4h wzIdYJ7KQEnLEy4Vec2s115bP7bT8kFISh8mggkjoVqSevn/PsszTKldlhL+4uOt UouZhCiQGCp9AkIlKigUP6wk1dKEJQ== =qF4y -----END PGP SIGNATURE----- --==-=-=-- --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=data-dirs-from-nix-profiles.patch diff --git a/common/info.cpp b/common/info.cpp index 8291cc7..6216326 100644 --- a/common/info.cpp +++ b/common/info.cpp @@ -36,6 +36,7 @@ #include "strtonum.hpp" #include "lock.hpp" #include "string_map.hpp" +#include "file_util.hpp" #include "gettext.h" @@ -495,6 +496,25 @@ namespace acommon { lst.clear(); lst.add(config->retrieve("data-dir")); lst.add(config->retrieve("dict-dir")); + if (config->lookup("data-dir") == NULL && config->lookup("dict-dir") == NULL) { + const char* cprofiles = getenv("NIX_PROFILES"); + if (cprofiles != NULL) { + char* profiles = strdup(cprofiles); + char* profile = profiles; + char* end = profile; + while (*end != '\0') { + if (*end == ' ') { + *end = '\0'; + lst.add(add_possible_dir(profile, "lib/aspell")); + profile = ++end; + } else { + ++end; + } + } + lst.add(add_possible_dir(profile, "lib/aspell")); + free(profiles); + } + } } DictExt::DictExt(ModuleInfo * m, const char * e) --=-=-=--