अधिकांश अनुप्रयोगों में , एप्लिकेशन-विशिष्ट हाल के दस्तावेज़ नाम की फ़ाइल में हैं:
~/Library/Preferences/com.company.application.LSSharedFileList.plist
टर्मिनल में इन सभी फाइलों को सूचीबद्ध करने के लिए, निम्नलिखित दर्ज करें:
ls -Ad Library/Preferences/* | grep LSSharedFileList
मैक ओएस एक्स 10.6 पर, ये फाइलें (आमतौर पर) एक द्विआधारी प्रारूप में हैं।
उन्हें देखने और संपादित करने के लिए संपत्ति सूची संपादक (Apple डेवलपर टूल / Xcode 3) या Xcode 4 का उपयोग करें।
जब एप्लिकेशन लॉन्च हो रहा हो तब वे फिर से पढ़े जाते हैं, न कि जब वह चल रहा होता है। आपको इस फ़ाइल को संपादित करते समय एप्लिकेशन को बंद करना होगा।
मुझे लगता है कि मैं ऊब गया था ...
#!/usr/bin/env bash
mode=$2
if [ -z "$mode" ] ; then
echo "Usage:"
echo "$0 <filename> ls - list recent file entries in specified *.LSSharedFileList.plist"
echo "$0 <filename> rm <idx> - remove recent file entry with given index from specified plist"
exit 1
fi
if [ "$mode" != "ls" ] && [ "$mode" != "rm" ] ; then
echo "second argument must be one of [ls, rm]"
exit 1
fi
file=$1
if [ -z $file ] ; then
echo "Need argument (recent items plist file)!"
exit 1
fi
if [ ! -f $file ] ; then
echo "File $file does not exist!"
exit 1
fi
if [ "$mode" = "ls" ] ; then
i=0
cont=1
while [ $cont ] ; do
recentfilename=$( /usr/libexec/PlistBuddy -c "Print RecentDocuments:CustomListItems:$i:Name" $file 2>/dev/null )
if [ "$?" -ne "0" ] ; then
cont=
else
echo "$i - $recentfilename"
i=$(( $i + 1 ))
fi
done
fi
if [ "$mode" = "rm" ] ; then
i=$3
if [[ $i =~ ^-?[0-9]+$ ]] ; then
# argument is integer
$( /usr/libexec/PlistBuddy -c "Delete RecentDocuments:CustomListItems:$i" $file )
else
echo "Expected integer, got $i as third argument"
exit 1
fi
fi
उपयोग:
$ ./editrecent.sh
Usage:
./editrecent.sh <filename> ls - list recent file entries in specified *.LSSharedFileList.plist
./editrecent.sh <filename> rm <idx> - remove recent file entry with given index from specified plist
$ ./editrecent.sh Library/Preferences/com.macromates.textmate.LSSharedFileList.plist ls
0 - rcd
1 - artifactory.sh
2 - py.py
3 - iTunes Music Library.xml
4 - iTunes Library.xml
5 - gradle-proxy-support.diff
6 - DefaultGradlePropertiesLoader.java
7 - DefaultGradlePropertiesLoader-proxy.java
8 - gradle-proxy-support.patch
9 - DefaultKeyBinding.dict
10 - DefaultKeyBindings.dict
$ ./editrecent.sh Library/Preferences/com.macromates.textmate.LSSharedFileList.plist rm 3
$ ./editrecent.sh Library/Preferences/com.macromates.textmate.LSSharedFileList.plist ls
0 - rcd
1 - artifactory.sh
2 - py.py
3 - iTunes Library.xml
4 - gradle-proxy-support.diff
5 - DefaultGradlePropertiesLoader.java
6 - DefaultGradlePropertiesLoader-proxy.java
7 - gradle-proxy-support.patch
8 - DefaultKeyBinding.dict
9 - DefaultKeyBindings.dict