Where Is PicList's Configuration Stored? A Complete Guide to Config File Locations
PicList stores its configuration in a JSON file inside the Electron user data directory, located at %APPDATA%/PicList/config.json on Windows, ~/Library/Application Support/PicList/config.json on macOS, and ~/.config/PicList/config.json on Linux.
PicList is an open-source image hosting tool built on Electron and Node.js. Knowing exactly where it persists settings is crucial for debugging, backup, or advanced customization. According to the PicList source code, the configuration path is dynamically resolved at runtime by the appConfigPath() utility in the datastore module.
Default Configuration File Location
How PicList Determines the Config Path
The exact file location is not hard-coded. Instead, PicList relies on Electron’s app.getPath('userData') API. In src/main/apis/core/datastore/dirs.ts, the appConfigPath() function concatenates the user data directory with the filename config.json.
// src/main/apis/core/datastore/dirs.ts
export function appConfigPath(): string {
return path.join(app.getPath('userData'), 'config.json');
}
This approach ensures the configuration follows the operating system’s conventions for application data.
Platform-Specific Paths
Because userData resolves to different folders on each OS, the absolute path varies:
- Windows:
%APPDATA%/PicList/config.json(e.g.,C:\Users\<User>\AppData\Roaming\PicList\config.json) - macOS:
~/Library/Application Support/PicList/config.json - Linux:
~/.config/PicList/config.json
If the file does not exist on first launch, PicList copies the bundled default configuration to this location.
Key Source Files Managing Configuration Storage
Understanding the codebase helps when you need to programmatically interact with settings. The following files in the kuingsmile/piclist repository handle persistence:
Accessing and Modifying the Configuration Programmatically
When building plugins or debugging, you often need to inspect or update the JSON directly. Below are copy‑pasteable snippets that mirror the logic used in PicList’s main process.
Retrieve the configuration file path
import { appConfigPath } from '@core/datastore/dirs';
import fs from 'fs';
const configPath = appConfigPath();
console.log('Config located at:', configPath);
Read the current configuration
import { appConfigPath } from '@core/datastore/dirs';
import fs from 'fs';
const raw = fs.readFileSync(appConfigPath(), 'utf-8');
const config = JSON.parse(raw);
console.log('PicList settings:', config);
Update a specific setting (e.g., change the default uploader)
import { appConfigPath } from '@core/datastore/dirs';
import fs from 'fs';
const cfgPath = appConfigPath();
const config = JSON.parse(fs.readFileSync(cfgPath, 'utf-8'));
config.uploader = 'github'; // modify the desired key
fs.writeFileSync(cfgPath, JSON.stringify(config, null, 2));
Reset to factory defaults
import { appConfigPath, defaultConfigPath } from '@core/datastore/dirs';
import fs from 'fs';
// Replace user config with the bundled default
fs.copyFileSync(defaultConfigPath(), appConfigPath());
All snippets assume you are running inside PicList’s main process or a script that can resolve the @core alias used by the project.
Summary
- PicList persists user settings in a JSON file whose path is resolved at runtime by
appConfigPath()insrc/main/apis/core/datastore/dirs.ts. - The file resides in the Electron
userDatadirectory:%APPDATA%/PicList/config.jsonon Windows,~/Library/Application Support/PicList/config.jsonon macOS, and~/.config/PicList/config.jsonon Linux. - The
DBStoreclass (src/main/apis/core/datastore/index.ts) handles reading, writing, and watching this file. - Developers can import
appConfigPath()anddefaultConfigPath()to manipulate the configuration programmatically or reset it to defaults.
Frequently Asked Questions
Can I move the PicList configuration file to a different folder?
No, PicList does not expose a setting to relocate the main config.json. The path is hard‑coded relative to Electron’s userData directory in appConfigPath(). If you need the config elsewhere, you can symlink the file after PicList creates it, but the application will always look in the standard location on startup.
What happens if I delete the configuration file?
If config.json is missing, PicList detects the absence on launch and copies the bundled default configuration (located via defaultConfigPath()) into the user data directory. This effectively resets the application to factory settings without breaking the installation.
Is the configuration file plain text or encrypted?
The file is stored as plain UTF‑8 JSON (or YAML in legacy versions). It is not encrypted, allowing users to edit it directly with a text editor or via scripts. Sensitive fields such as API keys are stored as‑is, so treat the file as confidential.
How do I programmatically update a setting from a plugin?
Import the appConfigPath() helper, read and parse the JSON, modify the desired property, and write it back. After saving, call picgo.saveConfig() to refresh the in‑memory cache so the change is immediately active. See the “Update a specific setting” snippet in the article above for a concrete example.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →