Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change the File class and regular expression function #8

Closed
wants to merge 9 commits into from
Closed

Change the File class and regular expression function #8

wants to merge 9 commits into from

Conversation

zero2hex
Copy link
Collaborator

Changes

  • Add a function 'searchWithRegularExpression' for using regular expression simply.
  • Change the File class formed utility(or helper) into that needs instantiation.
  • Add the libuv libraries and headers.

Examples

File reading

let file = Readable(fileAtPath: path).open()
var buffer = [UInt8](count: 8, repeatedValue: 0)
let data = NSMutableData()

while file.status == .Open {
    let result: Int = file.read(&buffer, maxLength: buffer.count)
    data.appendBytes(buffer, length: result)
}

file.close()

File writing

let file = Writable(fileAtPath: "\(path).swift", option: O_CREAT|O_TRUNC).open()
file.write(UnsafePointer<UInt8>(code.dataUsingEncoding(NSUTF8StringEncoding)!.bytes), maxLength: code.characters.count)

- Change the ServeStatic middleware to getting base path for initializing.
- Rename Route.getRegex() to Route.parsePath() and change its process simply.
- Rename File.getRealPath() to File.getResourcePath() and change its process. The process of its function is changed to simply.
- Add some exception check routine for file read/write function.
- Add readable/writable/exectable and type check function for file IO.
- merge original repo & forked repo.
- fix bug in File.getType.
Add a variable for status, remove included buffer. Change the structure into that need external buffer.
But the process for setting status may not be atomic..,
Move the directory that include headers and libraries about libuv into 'Trevi' folder.
- Add stream utility for read/write.
- StreamWritable is not implemented.
@zero2hex zero2hex closed this Feb 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant