Moto Hell - The Motorola Modding Community

Motorola Phone Models => Software (Phone) => Topic started by: BlinK_ on May 08, 2008, 01:50:17 pm



Title: [E2] File/Folder Chooser Script
Post by: BlinK_ on May 08, 2008, 01:50:17 pm
Hello everyone. I present you my new script. Its only useful for developers. Here goes the description:
Quote
# File/Folder Chooser script by BlinK_
# 2008.06.12
#
# This script will let you to select any file or folder.
# It uses show* binaries for GUI. Big thanks to the creators.
#
# This script takes three parameters:
# 1. [o,l,f] Tells what do you want to select from.
#         o - folders
#         l - symbolic links
#         f - files
# 2. [Starting directory] No explanation needed (: .
# 3. [Message] Message which is displayed in title.
#
# This script will return full path to selected file/folder,
# or number zero if cancel pressed.
#
# for example.:
#      ./fileChooser.lin olf / "Select file/folder"
#      This will start script at / and will let you to select
#      folders, symbolic links and regular files.
#
#      ./fileChooser.lin o /home/ "Select folder"
#      This will start script at /home/ and will let you to select
#      only folders.
#
# When navigating, select ../ to go back one folder.
# Select ./ to select current folder. All the folders have
# following /, symlinks have following @, and regular files
# have following *.
#
# This script does NOT follow symbolic links. It treats them
# as regular files.
#
# Known bugs: does not work with files or folders which have
# spaces in names.
#
# Inspired by Keaglez Wall Changer application. This script is
# a MUST for it. (:
#
# Big thanks to everyone who contributed to E2 community.
# Use this script wherever you want. (: But leave this header.

EDIT: New Version. Only a bug fix.


Title: Re: [E2] File/Folder Chooser Script
Post by: andrei on May 08, 2008, 05:05:04 pm
in *.lin? wow, superb bro...


Title: Re: [E2] File/Folder Chooser Script
Post by: keaglez on May 08, 2008, 11:45:29 pm
Nice one... ;D Uhmm...but im sorry to say this...there is a showFileBrowse already which is written in C++ and its doing a similar thing like ur script does... :) Btw, maybe i can help with the whitespace there...
ADD:
Ah...expr...command not found... :( I cant run this script properly... (am i miss this expr in my phone?) :'(


Title: Re: [E2] File/Folder Chooser Script
Post by: BlinK_ on May 09, 2008, 12:22:49 am
Yea. I saw somewhere showFileBrowse binary. But since it wasnt in my phone, I wrote this script.

I just noticed that /bin/expr is just a sym link to busybox in my phone. Could you check if your busy box has expr? If so, I will fix the script to use busybox directly.

EDIT: if you have showFileBrowse binary, can you send it over? Or maybe you know where to find source?



Title: Re: [E2] File/Folder Chooser Script
Post by: keaglez on May 09, 2008, 12:43:50 am
ShowFileBrowse here (https://motohell.com/index.php?topic=2107.0)... Ah...i got it now...busybox expr and sort...works... Hmm...btw it cant show files...
Quote
line 83: [: -gt: unary operator expected


Title: Re: [E2] File/Folder Chooser Script
Post by: error398 on May 09, 2008, 01:03:29 am
its not my level ;D


Title: Re: [E2] File/Folder Chooser Script
Post by: BlinK_ on May 09, 2008, 01:19:40 am
83rd line should look like this:
Quote
if [ $(busybox expr index ${fileTypes} f) -gt 0 ]; then

Does it look the same? If so, can you post what this command returns:
Quote
# busybox expr index ofl o


Title: Re: [E2] File/Folder Chooser Script
Post by: keaglez on May 09, 2008, 03:52:53 am
Ah... Nvm... Its my mistake... XD it works well btw... :)


Title: Re: [E2] File/Folder Chooser Script
Post by: BlinK_ on May 09, 2008, 04:33:50 am
Alright then. Uploaded fixed version at first post.