{"id":50289251,"url":"https://github.com/maxzz/to-bin-copy-go","last_synced_at":"2026-05-28T04:33:32.112Z","repository":{"id":360591992,"uuid":"1250826354","full_name":"maxzz/to-bin-copy-go","owner":"maxzz","description":"Binaries File Copier (Go Version) - CLI Utility for copying built binaries","archived":false,"fork":false,"pushed_at":"2026-05-27T03:24:22.000Z","size":27,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-27T05:12:11.105Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/maxzz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-27T02:14:25.000Z","updated_at":"2026-05-27T03:24:26.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/maxzz/to-bin-copy-go","commit_stats":null,"previous_names":["maxzz/to-bin-copy-go"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/maxzz/to-bin-copy-go","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxzz%2Fto-bin-copy-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxzz%2Fto-bin-copy-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxzz%2Fto-bin-copy-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxzz%2Fto-bin-copy-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maxzz","download_url":"https://codeload.github.com/maxzz/to-bin-copy-go/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxzz%2Fto-bin-copy-go/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33594851,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-28T02:00:06.440Z","response_time":99,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-05-28T04:33:31.453Z","updated_at":"2026-05-28T04:33:32.099Z","avatar_url":"https://github.com/maxzz.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DigitalPersona PM File Copier (Go Version)\n\nA robust, lightweight command-line utility written in Go for copying DigitalPersona PM native binaries and driver files from build output directories to the system's DigitalPersona installation directory.\n\nThis utility is a direct conversion of the original C# WinForms application `CopyPmFilesToBin` to Go. It keeps all of the original functionality intact, adding a cleaner command-line interface, detailed progress logs, and helpful system privilege warnings.\n\n---\n\n## Table of Contents\n\n- [Key Features](#key-features)\n- [Configuration File Format \u0026 Structure](#configuration-file-format--structure)\n  - [Flexible Path Syntax (Slashes \u0026 Normalization)](#flexible-path-syntax-slashes--normalization)\n  - [Comments Support](#comments-support)\n  - [Structure Breakdown](#structure-breakdown)\n  - [JSON Schema Template (with comments \u0026 mixed slashes example)](#json-schema-template-with-comments--mixed-slashes-example)\n- [Detailed Configuration \u0026 Target Mode Clarification](#detailed-configuration--target-mode-clarification)\n  - [Important: Target Modes vs. Utility Compilation](#important-target-modes-vs-utility-compilation)\n  - [Windows Registry Configuration \u0026 Fallback Format](#windows-registry-configuration--fallback-format)\n- [How to Run](#how-to-run)\n  - [Command-Line Arguments](#command-line-arguments)\n  - [Examples](#examples)\n  - [Example Configurations](#example-configurations-tests-directory)\n- [Folder Structure](#folder-structure)\n- [How It Works](#how-it-works)\n- [How to Build and Run (Using NPM/Node scripts)](#how-to-build-and-run-using-npm-node-scripts)\n  - [Using NPM Scripts](#using-npm-scripts)\n- [How to Build (Using Native Go Commands)](#how-to-build-using-native-go-commands)\n\n---\n\n## Key Features\n\n1. **Flexible Configuration Resolution (Hierarchical Fallback)**:\n   - **CLI Source flag (`-source`)**: Manually pass a comma-separated list of paths to bypass configuration files completely.\n   - **Custom Config File (`-config \u003cpath\u003e`)**: Point the tool to a custom JSON configuration file.\n   - **Default Config File (`config.json`)**: Looks for a `config.json` file in the current working directory, and falls back to looking next to the executable.\n   - **Windows Registry Compatibility**: If no config files are found or configured paths are empty, it automatically reads the registry key used by the C# application (`HKEY_CURRENT_USER\\SOFTWARE\\AATanam\\CopyPmFilesToBin`), making it fully backward-compatible with your existing registry setup!\n\n2. **Graceful DPAgent Termination**:\n   - Uses native Windows Win32 API (`FindWindowW`, `PostMessageW`, and `WaitForSingleObject`) via `golang.org/x/sys/windows` to gracefully request `DPAgent.exe` to close, and waits for its exit before performing the file copy.\n\n3. **Intelligent Timestamp Checking**:\n   - Compares Last Modified UTC times between the source and destination files. Files are only copied if the source file is strictly newer, saving writes and avoiding unnecessary copying.\n\n4. **Locked File Handling (File-In-Use Renaming)**:\n   - If copying fails because a file is locked or in use (Sharing Violation error `0x80070020`), the tool automatically renames the existing locked destination file (e.g., `DpFbView.dll` -\u003e `DpFbView_1.dll`, `DpFbView_2.dll`, etc.) and retries the copy successfully.\n\n5. **Administrator Privilege Warning**:\n   - Since copying to `C:/Program Files` or `C:/Program Files (x86)` requires elevated privileges on Windows, the tool checks for administrator rights on startup and outputs a user-friendly warning if it's run as a standard user.\n\n---\n\n## Configuration File Format \u0026 Structure\n\nIf you prefer using a `config.json` file rather than command-line arguments or the Windows Registry, you can place a `config.json` next to your executable.\n\n### Flexible Path Syntax (Slashes \u0026 Normalization)\n- **Mixed Slashes**: Both forward slashes (`/`) and backslashes (`\\`) are fully supported.\n- **Forward Slashes**: Use `/` in configuration paths (recommended; no escaping required in JSON).\n- **Backslashes**: Windows-style `\\` paths are also accepted at runtime and normalized automatically.\n- **Normalization**: Paths are automatically cleaned to match the host operating system's standard.\n- **Trailing Slashes**: Trailing slashes are automatically stripped (e.g., `C:/Folder/` becomes `C:/Folder`), preventing errors in suffix matching or folder joins.\n\n### Comments Support\nThis utility supports **JSON comments**. You are free to document your configurations directly inside JSON files using:\n- **Single-line comments** starting with `//`\n- **Multi-line block comments** starting with `/* ... */`\n\nThey will be stripped out before parsing, allowing for rich configuration notes.\n\n### Structure Breakdown\n\nThe configuration file is written in standard JSON format (with comment support). It begins with a top-level key named `\"items\"`, which is an array of configuration blocks/action sets.\n\nEach item in `\"items\"` contains:\n- **`name` (String, Optional)**: The unique identifier for this configuration set. If specified, it can be selected via the `-set \u003cname\u003e` flag on startup.\n- **`isActive` (Boolean)**: If set to `true`, this set will be processed during a default run (when no specific set is designated using the `-set` flag).\n- **`paths` (Object, Optional)**: Contains details on directory paths and inclusion/exclusion matching:\n  - **`dp` (Boolean)**: If `true`, the application executes its standard predefined file copies (such as `win32Files` or `x64Files`). If `false` or omitted, custom folder-to-folder file copying is performed based on directories.\n  - **`src` (Object)**:\n    - **`debug` (Array of Strings)**: Source directories where the Debug compiled files reside.\n    - **`release` (Array of Strings)**: Source directories where the Release compiled files reside.\n    - *Note: Source directories must end with either `Win32` or `x64` to designate their architecture.*\n  - **`dst` (Object)**:\n    - **`win32` (String)**: Target folder for Win32 files (defaults to `%ProgramFiles(x86)%\\DigitalPersona\\Bin`).\n    - **`x64` (String)**: Target folder for x64 files (defaults to `%ProgramFiles%\\DigitalPersona\\Bin`).\n  - **`srcFilesInclude` (Array of Strings, Optional)**: Active only when `dp` is `false`. List of regular expression patterns. Only files whose relative paths from the source directory match any of these patterns are copied. If omitted, all files are matched by default.\n  - **`srcFilesExclude` (Array of Strings, Optional)**: Active only when `dp` is `false`. List of regular expression patterns. Any files matching these patterns are excluded from being copied.\n- **`files` (Array of Objects, Optional)**: An alternative block of actions specifying individual files to copy directly:\n  - **`src` (String)**: Full path and filename of the source file.\n  - **`dst` (String)**: Full path and filename of the destination file.\n\n### JSON Schema Template (with comments \u0026 mixed slashes example)\n\n```json\n{\n  \"items\": [\n    {\n      \"name\": \"dp-binaries\",\n      \"isActive\": true,\n      \"paths\": {\n        \"dp\": true,\n        \"src\": {\n          \"debug\": [\n            \"C:/y/c/dp/pm-native/src/~Output/Debug.Win32/\",\n            \"C:/y/c/dp/pm-native/src/~Output/Debug.x64\"\n          ],\n          \"release\": [\n            \"C:/y/c/dp/pm-native/src/~Output/Release.Win32\",\n            \"C:/y/c/dp/pm-native/src/~Output/Release.x64/\"\n          ]\n        },\n        \"dst\": {\n          \"win32\": \"\",\n          \"x64\": \"\"\n        }\n      }\n    },\n    {\n      \"name\": \"custom-wildcard-copier\",\n      \"isActive\": false,\n      \"paths\": {\n        \"dp\": false,\n        \"src\": {\n          \"debug\": [\n            \"C:/build/Debug.Win32\"\n          ],\n          \"release\": [\n            \"C:/build/Release.Win32\"\n          ]\n        },\n        \"dst\": {\n          \"win32\": \"C:/Target/Win32\"\n        },\n        \"srcFilesInclude\": [\n          \"\\\\.dll$\",\n          \"\\\\.exe$\"\n        ],\n        \"srcFilesExclude\": [\n          \"test.*\"\n        ]\n      }\n    },\n    {\n      \"name\": \"individual-files\",\n      \"isActive\": true,\n      \"files\": [\n        {\n          \"src\": \"C:/my_source/custom_driver.sys\",\n          \"dst\": \"C:/Windows/System32/drivers/custom_driver.sys\"\n        }\n      ]\n    }\n  ]\n}\n```\n\n*Note: Using forward slashes `/` in paths is highly recommended so that no escaping is required in JSON strings.*\n\n---\n\n## Detailed Configuration \u0026 Target Mode Clarification\n\n### Important: Target Modes vs. Utility Compilation\nIt is crucial to clarify that the **Debug** and **Release** target modes **do not describe how this utility itself is compiled**, nor does running with `-release` change the performance characteristics of this Go tool. Rather:\n* **The mode dictates which sets of your project's compiled binary files are being targeted for copying.**\n* When running in **Debug mode** (default), the utility reads the paths where your C++/C# compiler outputs the **Debug target builds** (typically ending with `Debug.Win32` and `Debug.x64`).\n* When running in **Release mode** (using `-release`), the utility targets the paths where your compiler outputs the **Release target builds** (typically ending with `Release.Win32` and `Release.x64`).\n\n### Windows Registry Configuration \u0026 Fallback Format\n\nIf no command-line source directories are specified via `-source`, and no local `config.json` is found (or its paths list is empty), the utility automatically falls back to reading configuration from the Windows Registry.\n\nThe utility reads from the following registry path:\n* **Registry Key**: `HKEY_CURRENT_USER\\SOFTWARE\\AATanam\\CopyPmFilesToBin`\n\nWithin this key, the utility looks for two specific values depending on the target mode:\n\n1. **`sourcePathsDebug`** (Multi-String / `REG_MULTI_SZ`):\n   - Used when running in **Debug mode** (the default mode, without `-release`).\n   - Contains a list of source folders containing the Debug compiled native binaries and driver files.\n   - Example folders: `C:\\MyProject\\src\\~Output\\Debug.Win32`, `C:\\MyProject\\src\\~Output\\Debug.x64`.\n\n2. **`sourcePathsRelease`** (Multi-String / `REG_MULTI_SZ`):\n   - Used when running in **Release mode** (using `-release`).\n   - Contains a list of source folders containing the Release compiled native binaries and driver files.\n   - Example folders: `C:\\MyProject\\src\\~Output\\Release.Win32`, `C:\\MyProject\\src\\~Output\\Release.x64`.\n\n#### Accepted Registry Data \u0026 Behavior\n\n* **Value Type**: Must be a **Multi-String Value** (`REG_MULTI_SZ`). In Windows Registry Editor (`regedit.exe`), you can create this by right-clicking on the `CopyPmFilesToBin` key, selecting **New** -\u003e **Multi-String Value**, and naming it either `sourcePathsDebug` or `sourcePathsRelease`.\n* **Value Data**: Each line in the Multi-String value represents one source directory path.\n* **Architecture Suffix Detection**: Each directory path defined in these multi-string values must end with either `Win32` or `x64` (case-insensitive, e.g., `C:\\Output\\Debug.Win32` or `C:\\Output\\Debug.x64`).\n  - **Win32 source directories**: Target files are copied to the standard 32-bit (x86) DigitalPersona installation folder: `%ProgramFiles(x86)%\\DigitalPersona\\Bin` (typically `C:\\Program Files (x86)\\DigitalPersona\\Bin`).\n  - **x64 source directories**: Target files are copied to the standard 64-bit DigitalPersona installation folder: `%ProgramFiles%\\DigitalPersona\\Bin` (typically `C:\\Program Files\\DigitalPersona\\Bin`).\n* **Path Slashes \u0026 Normalization**: The registry paths support both forward slashes (`/`) and backslashes (`\\`). They are automatically cleaned and normalized at runtime:\n  - Trailing slashes are stripped.\n  - Windows-style backslashes are resolved properly.\n  - Spaces in paths are fully supported without needing quotes inside the registry value editor.\n* **Predefined File Lists**: Since the registry fallback processes standard DigitalPersona copying (equivalent to setting `\"dp\": true` in a JSON config), it copies the predefined set of files matching the architecture of the source folder:\n  - **Win32 Predefined Files**: `DpAgent.exe`, `DpFbView.dll`, `DpOFeedb.dll`, `DpoPS.dll`, `DpoSet.dll`, `DPPMAdminConsole.exe`, `DpoSetA.dll`, `DpoTrain.dll`, `DpoTrainMgr.dll`, `DpStgCat.dll`\n  - **x64 Predefined Files**: `DpAgentOtsPlugin.dll`, `DpAgentOtsPlugin.WebSdk.dll`, `DpFbView.dll`, `DpImporter.dll`, `DpMiniDS.dll`, `DpOCache.dll`, `DpOFeedb.dll`, `DpOnlineIDs.dll`, `DpoPS.dll`, `DpoSet.dll`, `DpOtsMsg.dll`, `DpUtt.dll`, `DsDashboard.dll`\n\n---\n\n## How to Run\n\n### Command-Line Arguments\n\n| Flag / Option | Description | Default Value \u0026 Usage Notes |\n| :--- | :--- | :--- |\n| `-release` | Targets **Release** compiled files instead of Debug compiled files. | `false` (by default, targets Debug compiled files). |\n| `-config \u003cpath\u003e` | Specifies the path to the custom JSON configuration file. | `\"config.json\"` (searches in the current working directory, falling back next to the executable). |\n| `-source \u003cpaths\u003e` | Comma-separated list of custom source directories to copy files from. Bypasses configuration files and Windows Registry fallbacks completely. | Unspecified.\u003cbr\u003e- **Spaces**: Enclose the list in double quotes, e.g. `-source \"C:/Folder With Spaces/Win32,C:/Other Folder/x64\"`. \u003cbr\u003e- **Commas**: Escape literal commas with a backslash, e.g. `\\,`. |\n| `-set \u003cname\u003e` | Designates a specific configuration set inside `config.json` to execute (and only this one). | Unspecified (by default, processes all sets where `isActive` is `true`). Executes the matching set regardless of its `isActive` flag status. |\n| `-force` | Force copy all matched files, bypassing the default timestamp comparison checks. | `false` (by default, copies only if the source file is strictly newer than the destination). |\n\n### Examples\n\n```bash\n# 1. Standard Run (Debug, uses registry fallback or local `config.json`):\n# Run with administrator privileges\n.\\copy-pm-files.exe\n\n# 2. Run in Release Mode:\n.\\copy-pm-files.exe -release\n\n# 3. Run with Custom Paths directly (bypassing configs):\n.\\copy-pm-files.exe -source \"C:/MySources/Debug.Win32,C:/MySources/Debug.x64\"\n\n# 4. Run with a Custom Configuration File:\n.\\copy-pm-files.exe -config C:/Users/Public/my_custom_config.json\n```\n\n---\n\n### Example Configurations\n\nWe have provided several configurations inside the `tests/` folder for reference or testing:\n\n- **`config_full_dual_arch.json`**: Complete setup with both Win32 and x64 directories configured for both Debug and Release environments.\n- **`config_x64_only.json`**: Restricts actions only to the 64-bit destination.\n- **`config_win32_only.json`**: Restricts actions only to the 32-bit (x86) destination.\n- **`config_custom_drive_paths.json`**: Demonstrates the use of alternate drives and directory naming layouts (e.g. `D:/BuildServer`).\n- **`config_empty.json`**: Empty arrays structure, triggering registry fallbacks when run.\n\nYou can try using any of these by passing the `-config` flag:\n```bash\n# Run using the custom drive configuration example\nnpm start -- -config tests/config_custom_drive_paths.json\n```\n\n---\n\n## Folder Structure\n\n- `src/`: Directory containing all Go source files.\n  - `main.go`: Entry point and program orchestration.\n  - `config.go`: Argument parsing, JSON configuration, and Windows Registry integration.\n  - `help.go`: Modular help output displaying usage, default options, and behaviors.\n  - `print.go`: Modular startup printing logic, active items formatting, and elevation warnings.\n  - `process.go`: Graceful Win32 process search and close logic for `DPAgent.exe`.\n  - `copy.go`: Core copy loop, timestamp comparison, and locked file renaming.\n  - `version.go`: Auto-generated version declaration.\n  - `copy_test.go`: Unit tests for file utility behaviors.\n  - `config_test.go`: Unit tests for argument resolution, configuration loading, and comment-stripping logic.\n- `scripts/`: Development and utility scripts.\n  - `build.js`: Auto-incrementing version builder that compiles the Go binary.\n- `tests/`: Directory containing various preconfigured examples of JSON configuration files.\n- `config.json`: Sample configuration file template.\n- `package.json`: NPM package manifest for unified scripts (run, test, build).\n- `.gitignore`: Configured to ignore Go/Node/Windows artifacts and generated binaries.\n\n---\n\n## How It Works\n\nThis utility orchestrates a structured, multi-step pipeline to safely and efficiently copy binary files into protected system directories on Windows. Below is an overview of the key phases and a visual execution flow diagram.\n\n### Key Phases of Execution\n\n1. **Initialization \u0026 CLI Parsing**: \n   - Activates ANSI virtual terminal sequence processing to support colored console logs in Windows.\n   - Parses the command-line flags (`-release`, `-config`, `-source`, `-set`, and `-force`).\n   - Checks if running with Administrator privileges and outputs a standard user warning if copying might require elevation.\n\n2. **Hierarchical Configuration Resolution**:\n   - **Step A**: Checks if `-source` was specified. If yes, it bypasses files and registry entirely.\n   - **Step B**: Otherwise, it tries to read the specified configuration JSON (defaulting to `config.json` next to the working directory or the executable). Comment lines (`//` and `/* ... */`) are dynamically stripped before parsing.\n   - **Step C**: If JSON loading fails or the paths list is empty, it queries the Windows Registry key `HKEY_CURRENT_USER\\SOFTWARE\\AATanam\\CopyPmFilesToBin` (reading either `sourcePathsDebug` or `sourcePathsRelease` multi-string values).\n   - **Step D**: If all resolution paths yield no folders, the process exits with a helpful error.\n\n3. **Target Mode \u0026 Path Normalization**:\n   - Normalizes all forward/backward slashes and strips trailing slashes to prevent join errors.\n   - Categorizes each source path as `Win32` or `x64` based on suffix detection (e.g., `Debug.Win32`).\n\n4. **Graceful Service Termination**:\n   - Before attempting to overwrite any binaries, the utility uses the Win32 API (`FindWindowW` and `PostMessageW`) to safely post a `WM_CLOSE` message to the `DPAgent.exe` application window.\n   - It waits up to 10 seconds for the service process to exit peacefully, preventing file lock conflicts.\n\n5. **Smart Timestamp Comparison \u0026 Force Flag**:\n   - For each target file, the tool compares the source and destination files' \"Last Modified\" times in UTC.\n   - Files are skipped if the source is not strictly newer, avoiding redundant write operations. This check can be bypassed entirely using the `-force` command-line flag.\n\n6. **Locked File Renaming (Conflict Resolution)**:\n   - If a target DLL or binary is actively locked by another process (e.g., a background service, explorer, or browser extension), a Sharing Violation error (`0x80070020`) occurs.\n   - The tool handles this by automatically renaming the locked target file in the destination folder to a backup name (e.g., `DpFbView.dll` is renamed to `DpFbView_1.dll`, then `DpFbView_2.dll`, etc.) and retrying the copy.\n\n7. **Copy Execution Modes**:\n   - **Predefined Files List**: Used when `\"dp\": true` (default/registry). Copies a strict predefined list of native files belonging to DigitalPersona.\n   - **Custom Sourced (Wildcard Matching)**: Used when `\"dp\": false`. Performs a directory walk over the source folder, applying custom regular expressions (`srcFilesInclude` / `srcFilesExclude`) to filter which files to copy.\n   - **Individual Files list**: Copies designated source-to-destination file pairs explicitly.\n\n### Execution Flow Diagram\n\n```mermaid\nflowchart TD\n    Start([Start copy-pm-files.exe]) --\u003e InitConsole[Initialize ANSI Colors]\n    InitConsole --\u003e ParseArgs[Parse CLI Arguments]\n    ParseArgs --\u003e ResolveConfig{Resolve Config \u0026 Items}\n    \n    %% Configuration Resolution\n    ResolveConfig -- \"'-source' Specified\" --\u003e CLIOverride[Use Comma-Separated CLI Sources]\n    ResolveConfig -- \"No '-source'\" --\u003e TryLoadJSON[Load JSON Config File]\n    TryLoadJSON -- JSON Success \u0026 Not Empty --\u003e ApplyJSON[Use Config Items from JSON]\n    TryLoadJSON -- JSON Fails or Empty --\u003e TryRegistry[Read Windows Registry \u003cbr\u003e HKEY_CURRENT_USER\\\\SOFTWARE\\\\AATanam\\\\CopyPmFilesToBin]\n    TryRegistry -- Registry Success \u0026 Not Empty --\u003e ApplyRegistry[Use Registry Paths as Config Items]\n    TryRegistry -- Registry Fails or Empty --\u003e ShowError[Print Error \u0026 Exit]\n    \n    CLIOverride --\u003e InitForce\n    ApplyJSON --\u003e InitForce\n    ApplyRegistry --\u003e InitForce\n    \n    InitForce[Initialize Force Flag \u0026 Print Startup Info] --\u003e CheckElevation[Check Administrator Privileges \u0026 Warn if Standard User]\n    CheckElevation --\u003e ExecItems[Loop through Config Items]\n    \n    %% Execution Loop\n    ExecItems --\u003e IdentifyArch[Identify Architecture Suffix \u003cbr\u003e 'Win32' or 'x64']\n    IdentifyArch --\u003e CheckDpAgent{Is DPAgent.exe Running?}\n    CheckDpAgent -- Yes --\u003e StopDpAgent[Gracefully Close DPAgent.exe \u003cbr\u003e FindWindow/PostMessage/WaitForSingleObject]\n    CheckDpAgent -- No --\u003e ResolveDst[Resolve Destination Directory \u003cbr\u003e Custom or System Default Paths]\n    StopDpAgent --\u003e ResolveDst\n    \n    ResolveDst --\u003e ProcessFiles{Process File Actions}\n    \n    %% File Actions processing\n    ProcessFiles -- Standard DP List --\u003e PredefinedList[Copy Predefined Architecture Files]\n    ProcessFiles -- Custom Sourced --\u003e RegexMatch[Walk Dir \u0026 Filter by Include/Exclude Regex]\n    ProcessFiles -- Individual Files --\u003e DirectCopy[Copy Specified File List]\n    \n    PredefinedList --\u003e CopyLoop[For Each File: Check Timestamp]\n    RegexMatch --\u003e CopyLoop\n    DirectCopy --\u003e CopyLoop\n    \n    %% Timestamp \u0026 Copy Logic\n    CopyLoop --\u003e CheckTimestamp{Is Source Newer or -force Set?}\n    CheckTimestamp -- No --\u003e SkipFile[Skip Copying]\n    CheckTimestamp -- Yes --\u003e TryCopy[Try Copying File]\n    \n    TryCopy --\u003e CheckLocked{Is File Locked / Sharing Violation?}\n    CheckLocked -- Yes --\u003e RenameLocked[Rename Locked File \u003cbr\u003e e.g. DpFbView.dll -\u003e DpFbView_1.dll]\n    RenameLocked --\u003e TryCopy\n    CheckLocked -- No/Success --\u003e NextFile[File Copied Successfully]\n    \n    SkipFile --\u003e NextFile\n    NextFile --\u003e MoreFiles{More Files?}\n    MoreFiles -- Yes --\u003e CopyLoop\n    MoreFiles -- No --\u003e MoreItems{More Config Items?}\n    \n    MoreItems -- Yes --\u003e ExecItems\n    MoreItems -- No --\u003e Finish([Print Process Complete \u0026 Exit])\n```\n\n---\n\n## How to Build and Run (Using NPM/Node scripts)\n\nYou can run the project using standard `npm` commands or the direct `go` commands below.\n\n### Using NPM Scripts\n\n- **Run in Debug Mode (Default):**\n  ```bash\n  npm start\n  ```\n- **Run in Release Mode:**\n  ```bash\n  npm run start:release\n  ```\n- **Build the executable:**\n  ```bash\n  npm run build\n  ```\n  This creates the compiled binary in `bin/copy-pm-files.exe`.\n- **Run unit tests:**\n  ```bash\n  npm test\n  ```\n\n---\n\n## How to Build (Using Native Go Commands)\n\nFirst, make sure you have Go installed on your machine.\n\n1. Install dependencies (specifically the Windows system bindings package):\n   ```bash\n   go get golang.org/x/sys/windows\n   ```\n\n2. Compile the binary:\n   ```bash\n   go build -o copy-pm-files.exe\n   ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaxzz%2Fto-bin-copy-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaxzz%2Fto-bin-copy-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaxzz%2Fto-bin-copy-go/lists"}