Fixed scope issue in localdrive, added --noexpand option to rm.
authorTom Sutcliffe <thomas.sutcliffe@accenture.com>
Fri, 06 Aug 2010 17:00:19 +0100
changeset 26 5d370dafea69
parent 25 482757737e59
child 27 17e35ffe449b
Fixed scope issue in localdrive, added --noexpand option to rm.
commands/localdrive/localdrive.cpp
core/builtins/ls.cif
core/builtins/rm.cif
core/src/commands.cpp
core/src/commands.h
plugins/consoles/guicons/group/guicons_makefont.mk
--- a/commands/localdrive/localdrive.cpp	Thu Aug 05 12:06:56 2010 +0100
+++ b/commands/localdrive/localdrive.cpp	Fri Aug 06 17:00:19 2010 +0100
@@ -84,7 +84,7 @@
 
 // More GCC issues (see qresources3\src\utils.cpp). Happily the compiler is happier with SLitC and DESC than it is with TLitC and _LIT
 #include <fshell/descriptorutils.h>
-#define CASE_LIT(x) case x: { LtkUtils::SLitC KName = DESC(#x); return &KName; }
+#define CASE_LIT(x) case x: { static const LtkUtils::SLitC KName = DESC(#x); return &KName; }
 
 const TDesC* MediaTypeDesc(TMediaType aType)
 	{
--- a/core/builtins/ls.cif	Thu Aug 05 12:06:56 2010 +0100
+++ b/core/builtins/ls.cif	Fri Aug 06 17:00:19 2010 +0100
@@ -18,6 +18,8 @@
 
 ==long-description
 
+By default ls will columnize the output list. On very large directory listings this may cause the ls command to run out of memory. If this happens, try using the C<-1>/C<--one> option, which will not attempt to format the output.
+
 Note, C<cd> can be used to navigate between drives, but the DOS approach of switching between drives with commands like C<c:> and C<e:> is also supported.
 
 ==argument filename dir_name optional
--- a/core/builtins/rm.cif	Thu Aug 05 12:06:56 2010 +0100
+++ b/core/builtins/rm.cif	Fri Aug 06 17:00:19 2010 +0100
@@ -28,6 +28,10 @@
 
 Force delete the file even if it is read-only (won't allow you to delete a directory containing read-only files).
 
+==option string n noexpand multiple
+
+This option takes a filename similar to the C<filename> argument. The difference is that it doesn't attempt to expand wildcards and instead passes them straight through to CFileMan. This can be useful when a directory has a huge number of files and C<rm *> fails with KErrNoMemory. In this case, try doing C<rm --noexpand *> instead.
+
 ==copyright
 
 Copyright (c) 2006-2010 Accenture. All rights reserved.
--- a/core/src/commands.cpp	Thu Aug 05 12:06:56 2010 +0100
+++ b/core/src/commands.cpp	Fri Aug 06 17:00:19 2010 +0100
@@ -698,6 +698,7 @@
 	{
 	delete iFileMan;
 	iFileNames.Close();
+	iNonExpandedFilenames.ResetAndDestroy();
 	}
 
 CCmdRm::CCmdRm()
@@ -748,7 +749,13 @@
 				err = DoDelete(fileName);
 				}
 			}
-		User::LeaveIfError(err);
+		LeaveIfErr(err, _L("Couldn't delete '%S'"), &fileName);
+		}
+
+	for (TInt i = 0; i < iNonExpandedFilenames.Count(); i++)
+		{
+		TInt err = DoDelete(*iNonExpandedFilenames[i]);
+		LeaveIfErr(err, _L("Couldn't delete '%S'"), iNonExpandedFilenames[i]);
 		}
 	}
 
@@ -770,8 +777,10 @@
 	{
 	_LIT(KCmdRmOptRecurse, "recurse");
 	_LIT(KCmdRmOptForce, "force");
+	_LIT(KCmdRmOptNoexpand, "noexpand");
 	aOptions.AppendBoolL(iRecurse, KCmdRmOptRecurse);
 	aOptions.AppendBoolL(iForce, KCmdRmOptForce);
+	aOptions.AppendStringL(iNonExpandedFilenames, KCmdRmOptNoexpand);
 	}
 
 void CCmdRm::ArgumentsL(RCommandArgumentList& aArguments)
--- a/core/src/commands.h	Thu Aug 05 12:06:56 2010 +0100
+++ b/core/src/commands.h	Fri Aug 06 17:00:19 2010 +0100
@@ -196,6 +196,7 @@
 	CFileMan* iFileMan;
 	TBool iRecurse;
 	TBool iForce;
+	RPointerArray<HBufC> iNonExpandedFilenames; // This is to prevent the normal behaviour of fshell expanding a '*' in iFileNames, in the case where the number of matches would be huge
 	};
 
 
--- a/plugins/consoles/guicons/group/guicons_makefont.mk	Thu Aug 05 12:06:56 2010 +0100
+++ b/plugins/consoles/guicons/group/guicons_makefont.mk	Fri Aug 06 17:00:19 2010 +0100
@@ -9,14 +9,13 @@
 # Initial Contributors:
 # Accenture - Initial contribution
 #
-GENERATED_SOURCE_DIR = $(EPOCROOT)epoc32\build\fshell/guicons\generated
+GENERATED_SOURCE_DIR = $(EPOCROOT)epoc32\build\fshell\guicons\generated
 GENERATED_SOURCE = $(GENERATED_SOURCE_DIR)\defaultfontdata.inl
 
 MAKMAKE : $(GENERATED_SOURCE)
 
 $(GENERATED_SOURCE) : ..\data\font_6x10.PNG
 	perl $(EPOCROOT)epoc32\tools\emkdir.pl $(GENERATED_SOURCE_DIR)
-	echo perl .\bin2lit.pl KDefaultFontImageData ^< ..\data\font_6x10.PNG ^> $(GENERATED_SOURCE)
 	perl .\bin2lit.pl KDefaultFontImageData < ..\data\font_6x10.PNG > $(GENERATED_SOURCE)
 
 CLEAN :