pw_ide: Remove Path.with_stem() uses

Path.with_stem() was added in Python 3.9, and we're trying to support
Python 3.8.

Change-Id: Ic1a416f238f3445e38bb2c2a2c750ba41e3b8843
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/111075
Reviewed-by: Chad Norvell <chadnorvell@google.com>
Pigweed-Auto-Submit: Rob Mohr <mohrr@google.com>
Commit-Queue: Rob Mohr <mohrr@google.com>
diff --git a/pw_ide/py/pw_ide/cpp.py b/pw_ide/py/pw_ide/cpp.py
index 979196a..23514d5 100644
--- a/pw_ide/py/pw_ide/cpp.py
+++ b/pw_ide/py/pw_ide/cpp.py
@@ -205,8 +205,9 @@
     path = Path(f'{_COMPDB_FILE_PREFIX}.json')
 
     if target:
-        path = path.with_stem(f'{_COMPDB_FILE_PREFIX}'
-                              f'{_COMPDB_FILE_SEPARATOR}{target}')
+        path = path.with_name(f'{_COMPDB_FILE_PREFIX}'
+                              f'{_COMPDB_FILE_SEPARATOR}{target}'
+                              f'{_COMPDB_FILE_EXTENSION}')
 
     return path
 
@@ -217,7 +218,7 @@
     path = Path(f'{_COMPDB_CACHE_DIR_PREFIX}')
 
     if target:
-        path = path.with_stem(f'{_COMPDB_CACHE_DIR_PREFIX}'
+        path = path.with_name(f'{_COMPDB_CACHE_DIR_PREFIX}'
                               f'{_COMPDB_CACHE_DIR_SEPARATOR}{target}')
 
     return path