Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by SylafrsOne · Jun 18, 2014 at 12:03 PM · listwwwfiledirectorysupported

WWW file:// protocol to list a directory

Hi !

Is WWW supporting directory listing with file:// protocol?

I've made a simple function :

 public static IEnumerator LoadText(
     string uri, 
     Action<bool, string> onLoad, 
     Action<float> onFrame = null
 )
 {
     if (OnLoad == null)
         throw new NullReferenceException("onLoad");

     WWW www = new WWW(uri);
 
     while (!www.isDone)
     {
         if (onFrame != null)
             onFrame(www.progress);
         yield return null;
     }
 
     if (onFrame != null)
         onFrame(www.progress);
 
     if (!string.IsNullOrEmpty(www.error))
     {
         onLoad(true, www.error);
     }
     else
     {
         onLoad(false, www.text);
     }
 }

I would like to use it to download (text) files and list distant shared directories :

 void Awake()
 {
     // string uri = "file://127.0.0.1/C://path/to/my/file.txt";   // Works
     // string uri = "file://127.0.0.1/C://path/to/my/directory";  // Doesn't work
     // string uri = "file://127.0.0.1/C://path/to/my/directory/"; // Doesn't work
     // string uri = "file:///C://path/to/my/directory/";          // Doesn't work
        string uri = "file:///C://path/to/my/directory";           // Doesn't work

     StartCoroutine(LoadText(uri, (error, text) =>
     {
         if (error)
             Debug.LogError("Download failed: " + text);
         else
             Debug.Log("Text: " + text);
     }, (progress) =>
     {
         Debug.Log("Progress: " + (progress * 100).ToString("F2") + "%");
     }));
 }

Is there someting I'm missing, or directory listing is not supported? I would like to get something like this:

 300: file:///C:/
 200: filename content-length last-modified file-type
 201: .rnd 1024 Tue,%2013%20Aug%202013%2011:46:43%20GMT FILE 
 201: 5543122f40370829a18c18aeb6b2 0 Tue,%2015%20Apr%202014%2010:29:43%20GMT DIRECTORY 
 201: Android 0 Wed,%2030%20Apr%202014%2012:48:16%20GMT DIRECTORY 
 201: IDE 0 Tue,%2012%20Jun%202012%2010:11:49%20GMT DIRECTORY 
 201: MiKTeX%202.9 4096 Mon,%2015%20Jul%202013%2015:51:26%20GMT DIRECTORY 
 201: PerfLogs 0 Tue,%2014%20Jul%202009%2003:20:08%20GMT DIRECTORY 
 201: Program%20Files 12288 Thu,%2017%20Apr%202014%2013:40:00%20GMT DIRECTORY 
 201: Program%20Files%20%28x86%29 40960 Fri,%2013%20Jun%202014%2008:38:49%20GMT DIRECTORY 
 201: Projects 8192 Tue,%2017%20Jun%202014%2015:50:59%20GMT DIRECTORY 
 201: Python33 4096 Thu,%2024%20Oct%202013%2015:24:53%20GMT DIRECTORY 
 201: SolidWorks%20Data 0 Mon,%2001%20Jul%202013%2015:57:33%20GMT DIRECTORY 
 201: Sphinx 4096 Thu,%2007%20Nov%202013%2010:36:34%20GMT DIRECTORY 
 201: Temp 0 Thu,%2017%20Apr%202014%2013:18:55%20GMT DIRECTORY 
 201: Users 4096 Thu,%2018%20Jul%202013%2010:12:59%20GMT DIRECTORY  
 201: Windows 24576 Mon,%2016%20Jun%202014%2008:36:38%20GMT DIRECTORY 
 201: cygwin64 4096 Mon,%2004%20Nov%202013%2017:42:11%20GMT DIRECTORY 
 201: dev 0 Thu,%2018%20Jul%202013%2014:34:03%20GMT DIRECTORY 
 201: gitblit 8192 Wed,%2018%20Jun%202014%2007:46:37%20GMT DIRECTORY 
 201: globdata.ini 1110 Fri,%2011%20Apr%202008%2008:07:18%20GMT FILE 
 201: julius-4.2.3 0 Fri,%2025%20Oct%202013%2008:47:32%20GMT DIRECTORY 
 201: msdia80.dll 904704 Fri,%2001%20Dec%202006%2021:37:14%20GMT FILE 
 201: pagefile.sys 0 Thu,%2001%20Jan%201970%2000:00:00%20GMT FILE 
 201: scmserver 0 Thu,%2016%20Aug%202012%2008:29:17%20GMT DIRECTORY 
 201: vcredist.bmp 5686 Fri,%2011%20Apr%202008%2008:07:18%20GMT FILE 
 201: wamp 4096 Fri,%2022%20Nov%202013%2014:03:07%20GMT DIRECTORY 




Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Graham-Dunnett · Jun 30, 2014 at 11:22 AM

WWW cannot be used to access a directory.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

A node in a childnode? 1 Answer

How to detect file type loaded from device local storage 1 Answer

How to create a list of prefabs when given path in project directory 1 Answer

EditorUtility.OpenFilePanel uses \ FileInfo.Name uses / 0 Answers

OBB. How I can access files in OBB? 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges