The Dink Network

Reply to Re: New Development File: browser editor

If you don't have an account, just leave the password field blank.
Username:
Password:
Subject:
Antispam: Enter Dink Smallwood's last name (surname) below.
Formatting: :) :( ;( :P ;) :D >( : :s :O evil cat blood
Bold font Italic font hyperlink Code tags
Message:
 
 
May 17th 2018, 12:21 PM
spike.gif
SlipDink
Peasant He/Him United States bloop rumble
2nd generation. No easy way to be free. 
Okay, I can see now that my initial startup (loading editor.html) as a test was bound to fail, as I did not start it in my ~/dmod directory with ?[dmod-name] at the end of the URL. I was hoping to just get a rough idea of it's functionality without actually loading a dmod. But, I understand now that this would not work.

Anyway, it took quite a while to load up a small dmod and (from what I could tell) it did not seem to have all the tabs working when complete. But then I suppose you know that, right? The [World] tab showed nothing but a blank light tan-brown web page. The [Frame] and [Animation] tabs each showed a white web page. The [Tile] tab seemed to display the one tile in question in the small dmod I loaded. But nothing else seems to work.

Due to the fact that Dink.ini, DINK.INI and dink.ini all are considered as valid forms of filenames for dmods is something else that seems to get in the way of this editor working. This is especially tue of older dmods of course. I realize that you already mentioned that limitation. So, this morning, I wrote this short script that I named "lower.sh" (see below) that you might want to bundle with your editor.

#!/bin/sh
# This shell script converts all file and directory names
# under the passed in directory to lower case. It should
# work (perhaps with some light modification) for any
# *nix like operating system with a bash-like shell. It 
# assumes full write privileges to all files it processes
# and that no file or directory names have spaces in them.
#
# Assign EDITOR to the name of your favorite text editor.
#
EDITOR=`which gvim`
#
# SlipDink Thu May 17 10:22:07 EDT 2018
#
SCRIPT=`basename $0` 
HOSTNAME=`hostname |awk -F\. '{print $1}'`
USERNAME=`whoami`
VERSION=1.0a
TMP=/tmp/$SCRIPT.tmp
LOG=/tmp/$SCRIPT.log
START=$1
if [ -z "$START" ]; then
	START="."
fi
if [ -d "$START" ]; then
	true
else
	echo Does the [$START] directory exist?
	exit	
fi
FOUNDSOME=1

doitdir () {
	OLDNAME="$1"
	SAVEWORKINGDIR=`pwd`
	DIR_TO_RENAME=`echo $OLDNAME | awk -F\/ '{print $NF}'`
	DIRSABOVE=`echo $OLDNAME | awk -F\/ '{for (i = 1; i< NF; i++) {if (i==1) {printf("%s", $i)} else {printf("/%s", $i)}}}'`

	echo cd $DIRSABOVE
	cd $DIRSABOVE
	NEWNAME=`echo $DIR_TO_RENAME | tr "[:upper:]" "[:lower:]"`
	if [ "$NEWNAME" != "$DIR_TO_RENAME" ]; then
		mv -v "$DIR_TO_RENAME" "$NEWNAME"
		FOUNDSOME=`expr $FOUNDSOME - 1`
	fi
	cd $SAVEWORKINGDIR
}
	
doitfile () {
	OLDNAME="$1"
	NEWNAME=`echo $OLDNAME | tr "[:upper:]" "[:lower:]"`
	if [ "$NEWNAME" != "$OLDNAME" ]; then
		mv -v "$OLDNAME" "$NEWNAME"
	fi
}
	
#main
{
echo "Running version $VERSION of $SCRIPT on $HOSTNAME for $USERNAME."
doitdir "$START"
RESTART=`echo $START | tr "[:upper:]" "[:lower:]"`
FOUNDSOME=1
cd $RESTART
until [ "$FOUNDSOME" -eq 0 ]; do
	find . -type d -print|grep  "[A-Z]"|awk '{print length($1)"\t"$1}' |sort -rn |cut -d' ' -f2- >$TMP
	FOUNDSOME=`wc -l $TMP|awk '{print $1}'`
	while read "i"; do
		i=`echo $i |awk '{print $2}'`
		if [ "$i" != "." ];then
			doitdir "$i"
		fi
	done <$TMP
done

find $RESTART -type f -print|sort >$TMP
while read "i"; do
	doitfile "$i"
done <$TMP
/bin/rm $TMP
} 2>&1 |tee $LOG 2>&1

$EDITOR $LOG &


At this point, I think I'll wait for a later release to continue testing this editor. I want to try to get my next dmod ready in time for the contest.