Arc Forumnew | comments | leaders | submitlogin
Error when i try to make clone of HN in windows
2 points by ashwinm 4826 days ago | 2 comments
i have downloaded arc3.1 and Racket in my windows 7 machine. i have solved many errors as instructed in http://www.arclanguage.org/item?id=12397 Now when i enter (nsv) following error occurs and localhost:8080 comes out blank

  arc> (nsv)
  'rm' is not recognized as an internal or external command,
  operable program or batch file.
  load items:
  ranking stories.
  user break

  === context ===
  C:\arc3.1\ac.scm:1031:20
   gs1259

  ready to serve port 8080
  user break

  === context ===
  C:\arc3.1\ac.scm:1031:20
   gs1259

  open-input-file: cannot open input file: "C:/dev/urandom"
  (The system cannot find the path specified.; errno=3)

  === context ===
   rand-string
   new-fnid
   fnid
   flink
  zz
  zz
  zz
   gs2061
   cache
   newspage
   gs2059
   gs1059
   handle-request-thread


3 points by thaddeus 4825 days ago | link

When it comes to running news I think there's only one reference to "rm" in the "load-items" function of news.arc. It removes all ".tmp" files if any are hanging around. Since load items only happens on initialization, you can just remove that line of code. You could do the same thing using whatever means you use to load the app (i.e. manually if you want or an OS script would be better).

Also the other file-operation changes that you will need to make are:

-- In ac.scm

    1. add at the top:
    (require (lib "file.ss"))

    2. add at the bottom near the other xdef's:

    (xdef 'make-directory make-directory)
    (xdef 'make-directory* make-directory*)

 -- In arc.arc change these functions to: 

    (def mkdir (path (o parents))
         (if (is parents nil)
             (make-directory path)
             (make-directory* path)))

    (def ensure-dir (path)
        (unless (dir-exists path)
             (mkdir path t)))
You could probably look up the rm operation within file.ss and add it too.

The only other one fix I think you might need to make would be to the the shash function in app.arc, which I believe is unixy.

It's been a long time since I looked so there could be other things too.

-----

2 points by Pauan 4826 days ago | link

Ah, yes, that's because Arc is relying upon Unixisms such as "/dev/urandom" and the "rm" command, neither of which are in Windows. Those two things (among others) would need to be changed to be platform agnostic. The easiest way to do that would be to rewrite them using Racket's functionality which is already platform-agnostic.

Alternatively, the link you gave in your post seems to suggest that installing Cygwin would fix it as well.

-----