dnicolson / Binary-Plist

🔀 Visual Studio Code extension to read and write binary plist files
MIT License
18 stars 1 forks source link

no second tab #119

Closed TBugReporter closed 1 month ago

TBugReporter commented 1 month ago

Your project page says "another tab will open in XML", but this isn't happening for me. The one tab that does open looks a lot like XML, but with regions of nothing but control characters interspersed. What might I need and not have for this to work?

dnicolson commented 1 month ago

You shouldn't need to do anything to make it work.

What is your environment? Can you provide a reduced plist file and/or a video recording?

TBugReporter commented 1 month ago

reduced plist file

Perhaps this is part of the problem; the files I'm working with regularly exceed 50MiB - and, because they're binary, editing them is a RPITA. I was hoping your extension would simplify this.

What is your environment?

Fairly standard Win11 machine. (No fruit in sight. :-)

Can you provide a reduced plist file and/or a video recording?

Not at the moment; I will see which one of these is easier to produce - but it will have to wait until tomorrow, at least.

TBugReporter commented 1 month ago

I don't know if this shows what you need to know, but I made a screen recording. I'm also not sure the resolution is good enough to understand what's happening, so here's the blow-by-blow:

Before starting the recording, I resized the VS Code window to almost maximized, leaving a sliver of desktop visible on the right, and put a file called "my huge.plist" there on the visible portion. I usually have several tabs open in VS Code, so just for kicks, I opened the Settings page and the Keyboard Shortcuts list. I also updated VSc to 1.92.0 before recording and left the Release Notes tab open, and also checked for any updates to your extension. After starting the screen recorder, I dragged "my huge.plist" from the Desktop to the open space at the right of the tab bar. This caused the "Open Anyway" screen to appear, and I clicked that button and selected "Text Editor" from the top of the screen, as your instructions say to do. From there I get the expected tab full of gibberish, but no second tab. (You can see that the first few characters of this file are "bplist00", presumably indicating a binary plist file.) Finally I wiggle the mouse at the right end of the tab bar where I would have expected the second tab to appear, just to emphasize the point before ending the recording.

https://github.com/user-attachments/assets/6e60bb9b-bdea-4911-87fa-29d3a144cddd

dnicolson commented 1 month ago

It appears that VS Code restricts extensions from accessing files larger than 50MB (https://github.com/microsoft/vscode/issues/31078).

You can use Sublime Text with the BinaryPlist package for these files.

TBugReporter commented 1 month ago

I suppose that's a good solution, but I'm aiming for eventually creating a program or script that will do the editing for me, with as few external components as possible. Those links suggest that Python might be a good language to write this script in; do you have any better suggestions? (So far, my experience with Python is limited to the PythonScript extension for Notepad++.)

dnicolson commented 1 month ago

This extension uses Python on Windows and Linux for the binary conversion if it is installed.

It's pretty straightforward to load a binary plist, make changes, and save it again as binary:

import plistlib

plist_path = 'path/to/your/file.plist'

plist_file = open(plist_path, 'rb')
plist_data = plistlib.load(plist_file)
plist_file.close()

# make changes
print(plist_data)

plist_file = open(plist_path, 'wb')
plistlib.dump(plist_data, plist_file)
plist_file.close()