1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Solved Most efficient way to copy world files to a new directory

Discussion in 'Development' started by xBeastMode, Apr 20, 2017.

  1. xBeastMode

    xBeastMode Shog Chips

    Messages:
    0
    I want to copy world files to a different directory but I don't want it to freeze the main thread if the world files are too big. So I want to know if there is a good way to copy the files to a new directory. Async task can't run for more than a few seconds and hence they're not an option. Is there a way to start a new thread and let the files be copied in that thread?
     
  2. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,968
    GitHub:
    sof3
    It's OK to use AsyncTask. "A few seconds" is just an approximate way of saying it. The mechanism of copying worlds is exactly what AsyncTask is designed for.
     
    xBeastMode likes this.
  3. xBeastMode

    xBeastMode Shog Chips

    Messages:
    0
    Oh, thanks for clarifying this up. :D
     
  4. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,968
    GitHub:
    sof3
    Also note that if your world is extracted from a zip archive of compression level 0 (no compression, archive only), or a .tar file (without .gz), it may or may not be faster than copying files from another directory, since there is no need to list directories and open many file streams (just one).
     
  5. xBeastMode

    xBeastMode Shog Chips

    Messages:
    0
    Not gonna be using archives anyways. Only raw files from world directories.
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.