Skip to content

feat: add standalone Android file manager for PaperMC directories#1

Open
coobbi wants to merge 1 commit into
mainfrom
codex/create-a-file-manager-for-papermc
Open

feat: add standalone Android file manager for PaperMC directories#1
coobbi wants to merge 1 commit into
mainfrom
codex/create-a-file-manager-for-papermc

Conversation

@coobbi
Copy link
Copy Markdown
Owner

@coobbi coobbi commented Mar 27, 2026

Motivation

  • Provide a standalone Android app to manage a PaperMC server directory on-device, enabling users to browse folders, edit text files, and import maps/plugins from phone storage using a polished Material UI built with Java + XML.

Description

  • Add a self-contained Android app module and project build files (settings.gradle, build.gradle, gradle.properties) to bootstrap the project and dependencies.
  • Implement MainActivity to display the home/mcpaper root (inside app external files), navigate folders, show file metadata, and import files via the system document picker (ActivityResultContracts.OpenDocument).
  • Implement EditorActivity to load and save text file content, plus helper FileUtils and adapter FileListAdapter for the file list UI, and include corresponding layouts, drawables and resource values (res/layout/*, res/drawable/*, res/values/*).
  • Update project README.md with usage and run instructions and add basic ProGuard and theme resources.

Testing

  • Ran gradle -v in the environment and it completed successfully.
  • Attempted gradle wrapper to validate AGP resolution and wrapper generation, which failed because the Android Gradle Plugin artifact could not be resolved in this environment (plugin resolution issue, not application logic failure).

Codex Task

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1452f1e77c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".


private void saveContent() {
try {
Files.writeString(editingFile.toPath(), binding.editor.getText().toString(), StandardCharsets.UTF_8);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Block save when initial file read failed

If Files.readString(...) fails (for example on binary or non-UTF-8 files), the activity only shows a toast and keeps the Save button active; pressing Save then writes the current editor buffer (often empty) back to the same path and can silently corrupt the original file. This is reproducible by opening a .jar/binary file from the list and tapping Save after the read error.

Useful? React with 👍 / 👎.

fileName = "imported_" + System.currentTimeMillis();
}

File dest = new File(currentDirectory, fileName);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Sanitize imported display names before building destination path

DISPLAY_NAME comes from the document provider and is used directly in new File(currentDirectory, fileName); a crafted name containing path separators or .. can escape the current folder and write outside the intended PaperMC subtree. This makes import behavior unsafe against malicious/buggy providers and can overwrite unrelated files the app can access.

Useful? React with 👍 / 👎.

}

private void setupDirectory() {
File base = new File(getExternalFilesDir(null), "home/mcpaper");
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Guard against null external storage directory

getExternalFilesDir(null) may return null when external storage is unavailable, but the code still constructs new File(null, "home/mcpaper") and continues as if setup succeeded. In that state the app points at an invalid/relative root and later file operations (listing/import) fail unpredictably instead of failing fast with a clear fallback.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant