Hi !
I have determined, that Path.InvalidPat hChars does not return an array
with all invalid path characters. For instance the question mark (?)
does not appear in the array, but it is not possible to create a folder
with a question mark (?).
How can I get the whole range of invalid path characters ? Or is it the
best way, to create a folder and using try/catch ?
Regards 3 5996
You should try catch it as it isnt garunteed to work even with a good name as
permissions or name clashes could still get in the way. Plus it may change in
future OS's. Spaces didnt used to be allowed in windows.
Ciaran O'Donnell
"schaf" wrote:
Hi !
I have determined, that Path.InvalidPat hChars does not return an array
with all invalid path characters. For instance the question mark (?)
does not appear in the array, but it is not possible to create a folder
with a question mark (?).
How can I get the whole range of invalid path characters ? Or is it the
best way, to create a folder and using try/catch ?
Regards
schaf wrote:
Hi !
I have determined, that Path.InvalidPat hChars does not return an array
with all invalid path characters. For instance the question mark (?)
does not appear in the array, but it is not possible to create a folder
with a question mark (?).
Hi,
MSDN: This array (InvalidPathCha rs) is not guaranteed to contain the
complete set of characters that are invalid in file and directory
names. The full set of invalid characters can vary by file system...
>
How can I get the whole range of invalid path characters ? Or is it the
best way, to create a folder and using try/catch ?
Regards
Alternative way is to leave in the path name only exactly valid
characters instead of looking for possible invalid ones.
Ex.:
string path = @"c:\\test\d f ?sdg\1.txt";
System.Text.Reg ularExpressions .Regex re = new
System.Text.Reg ularExpressions .Regex(@"[^\w\\:.]+");
path = re.Replace(path , "");
Maybe it helps somehow.
Hi marss
Alternative way is to leave in the path name only exactly valid
characters instead of looking for possible invalid ones.
Ex.:
string path = @"c:\\test\d f ?sdg\1.txt";
System.Text.Reg ularExpressions .Regex re = new
System.Text.Reg ularExpressions .Regex(@"[^\w\\:.]+");
path = re.Replace(path , "");
Maybe it helps somehow.
I have a similar alternative way, I do not want to update my regex or
char-array, each time the user changes the OS. And I'm not sure, if the
chinese version of windows has the same invalid character like a german
or english windows. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Thomas Heller |
last post by:
I was trying to track down a bug in py2exe where the executable did
not work when it is in a directory containing japanese characters.
Then, I discovered that part of the problem is in the zipimporter that
py2exe uses, and finally I found that it didn't even work in Python
itself.
If the entry in sys.path contains normal western characters, umlauts for
example, it works fine. But when I copied some japanese characters from
a random...
|
by: Webdad |
last post by:
Hi!
I running my first year as industrial engineer (informatics)
We have an assignment to do :
.... create a playfield (matrix). Some places in that field are
blocked, so you can't pass them. The others are free to go over ...
(I already found that part)
-> http://users.pandora.be/hebbrecht/jochen/c++/test.cpp
|
by: Karl Koscher |
last post by:
I'm trying to communicate with a USB device using C#. I'm able to determine
the device path using P/Invoke and SetupDiGetClassDevs,
SetupDiEnumDeviceInterfaces, and SetupDiGetDeviceInterfaceDetail, but I
can't open the device using File.Open. I get the following error:
An unhandled exception of type 'System.ArgumentException' occurred in
mscorlib.dll
Additional information: Illegal characters in path.
|
by: I am Sam |
last post by:
I keep getting this error and I don't know why:
The path is too long after being fully qualified. Make sure path is less
than 260 characters.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information about
the error and where it originated in the code.
Exception Details: System.IO.PathTooLongException: The path is too long
|
by: Seth |
last post by:
Ok, here is my setup. I have a fully functioning HTTP Handler
implemented. The handler is supposed to handle every single request
that comes in to a particular virtual directory. Thus, in IIS, I have a
mapping of .* to the aspnet_isapi.dll. And my web.config has an entry
thusly:
<add verb="*" path="*" type="HandlerClass, HandlerAssembly" />
And this is working just fine thus far. The handler gets all the
requests and works like a...
| |
by: al jones |
last post by:
As a learning exercise in VS 2005 - BASIC, I'm working on a program which
may be run on any of the (hopefully) later versions of Windows - assume 98
- XP.
Is there a quick / dirty way to determine which is the invalid character in
the path / folder name? Given that, I can arbitrarily (arbitrary
programmers, right!) replace it with a valid character (space or underscore
or ...)
|
by: Luis Arvayo |
last post by:
I am compiling and executing c# code at runtime and I need to define in
CompilerParameters.ReferencedAssemblies one of my own assemblies together
with the standard System.dll u others.
Example:
// compiler options
System.CodeDom.Compiler.CompilerParameters options = new
System.CodeDom.Compiler.CompilerParameters();
options.GenerateExecutable = false; // result is a dll
|
by: cdkorzen |
last post by:
I'm sorry if this is a rehash, but all I see is the same info.
Here's my debacle:
I CAN get the PATH_INFO to work. With ANYTHING but ASP. Python, Perl,
Cmd files... works fine. ASP can't find a file when extra path
information is added. Is there a switch in ASP or something I can
change that'll get it to work?
Thanks!
|
by: moondaddy |
last post by:
I'm posting code for a user control ( FunctionConnectorSelector) below which
has 3 content controls in it. each content control uses a style from a
resource dictionary merged into the app.xaml file. each control has a
border with another style, and each border has a unique path inside of it.
I need to dynamically add these content controls using c# at runtime and am
having trouble referencing the styles and adding the path into the...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |