Come abbellire i file binario del ditt?

2

Ho aperto /System/Library/Frameworks/AppKit.framework/Resources/StandardKeyBinding.dict in vim, e sembra un jibberish. C'è un modo per convertirlo in umano leggibile solo per vedere cosa contiene?

    
posta trusktr 08.11.2014 - 22:05
fonte

2 risposte

3

Se hai plutil installato

Puoi eseguire questo Applescript che creerà una versione di testo del dizionario da leggere.

   property copyScriptPath : "~/Documents/" (* path dir for text version*)

tell application "Finder"
    set selectFiles to (get selection) (* get the finder selection*)
end tell
repeat with i from 1 to number of items in selectFiles
    (* convert to POSIX path*)
    set this_item to quoted form of POSIX path of (item i of selectFiles as alias)


    (* get the file name , add it to an alias, then use plutil to read and write atext version out using the original name*)
    do shell script "name='basename " & this_item & "';/usr/bin/plutil -convert xml1  " & this_item & " -o  " & copyScriptPath & "\"$name\".txt"
end repeat

o

C'è un vecchio suggerimento su macosxhints - 10.4: Modifica file plist binari (e normali) con vim

Il post contiene anche il collegamento allo script vim che fa tutto questo.

Che può fare ciò che vuoi. (non usare me stesso)

Citazione dal post (ma per favore vai a leggerlo perché ci sono commenti e note che ti serviranno:

What does it do? It reads a plist file, checks and memorizes if it is binary, converts it to plain text if necessary and turns on syntax highlinghting for XML. When you save the file again, it is converted to binary again for writing if it was binary in the beginning. If the file was not binary or if the conversion to binary fails (which can happen if you have syntax errors in your file), the file is stored in text format. If an originally-binary plist is saved as plain text due to syntax errors and you fix the errors and save the file again, it is written in binary format. If you open a binary file and just view it without making any changes, you can still exit from vim using the normal :q (no need for :q!) and the file is left untouched (still in binary format). All this should work even when working with several buffers (files), when reading a file into an existing buffer, or when only writing parts of a buffer to file

risposta data 08.11.2014 - 22:19
fonte
0

Ecco il metodo per rendere il file StandardKeyBinding.dict correttamente leggibile:

plutil -convert xml1 StandardKeyBinding.dict

Non serve a riconvertirlo.

    
risposta data 08.11.2014 - 23:57
fonte

Leggi altre domande sui tag