From patchwork Mon Jun 3 19:37:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Orgad Shaneh X-Patchwork-Id: 32977 Received: (qmail 50732 invoked by alias); 3 Jun 2019 19:37:35 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 50724 invoked by uid 89); 3 Jun 2019 19:37:35 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=H*m:gmail, msys, HContent-Transfer-Encoding:8bit X-HELO: mail-wm1-f68.google.com Received: from mail-wm1-f68.google.com (HELO mail-wm1-f68.google.com) (209.85.128.68) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 03 Jun 2019 19:37:33 +0000 Received: by mail-wm1-f68.google.com with SMTP id 16so8014808wmg.5 for ; Mon, 03 Jun 2019 12:37:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=oP8tloTnZKDm0ydrywhuvnYmqSk997tzWNm0qJV/y14=; b=kJQmMfeOb7OGbgFwYRomtJWaBCdRMz9k1wn2EEoA3tTCXzPMKD9uTTs8E91tK2Xkt2 lfUoAte6mnh70cjhA2JnC7kOQYO+8iFynHftg/2RmKi58W7eCLJauTNbhF9TcQRKsexc LBOtSafx/qP9tXGujdJKB1Lw2uZsJTjgM7JjjBMElHMEFqS0eBPP42PzP+4b3E0u0ehy qVWPJEBC+OdPFfX/oys/V/tqrW/hM8FnIKwOd6qHGy2hKhx/223QM4JIJ+02fDmlMBp3 bqMO8/zI6Ak2yZXV+XVUxpJX9r4IhVmPw62raY4fv2sef1gl1hnmcU3XCujF87olqP9S qaSQ== Return-Path: Received: from junior.corp.audiocodes.com ([212.76.104.181]) by smtp.gmail.com with ESMTPSA id s127sm12207162wmf.48.2019.06.03.12.37.29 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 03 Jun 2019 12:37:30 -0700 (PDT) From: orgads@gmail.com To: gdb-patches@sourceware.org Cc: Orgad Shaneh Subject: [PATCH] Fix cache dir resolving on Windows Date: Mon, 3 Jun 2019 22:37:16 +0300 Message-Id: <20190603193716.4861-1-orgads@gmail.com> MIME-Version: 1.0 From: Orgad Shaneh ... when not running from MSYS environment, and HOME is not set. --- gdb/common/pathstuff.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gdb/common/pathstuff.c b/gdb/common/pathstuff.c index 2b1669a5b9..edb8a1fcda 100644 --- a/gdb/common/pathstuff.c +++ b/gdb/common/pathstuff.c @@ -231,6 +231,10 @@ get_standard_cache_dir () #endif const char *home = getenv ("HOME"); +#ifdef _WIN32 + if (home == nullptr) + home = getenv ("USERPROFILE"); +#endif if (home != NULL) { /* Make sure the path is absolute and tilde-expanded. */