# Using custom \`main(String\[\] args)\` breaks file reading functions in Windows (e.g. \`loadShader()\`, \`loadImage()\`)

**URL:** <https://discourse.processing.org/t/using-custom-main-string-args-breaks-file-reading-functions-in-windows-e-g-loadshader-loadimage/2572>\
**Category:** Coding Questions\
**Created:** [August 12, 2018, 1:16pm UTC](https://discourse.processing.org/t/using-custom-main-string-args-breaks-file-reading-functions-in-windows-e-g-loadshader-loadimage/2572 "2018-08-12T13:16:30Z")\
**Posts on this page:** 1\
**Showing post:** 14

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [August 13, 2018, 9:33am UTC](https://discourse.processing.org/t/using-custom-main-string-args-breaks-file-reading-functions-in-windows-e-g-loadshader-loadimage/2572/14 "2018-08-13T09:33:28Z")

</div>

By default, field PApplet::_sketchPath_ would point to the “Current Working Directory” (CWD):

> **[Working directory](https://en.wikipedia.org/wiki/Working_directory)**
>
> In computing, the working directory of a process is a directory of a hierarchical file system, if any,\[nb 1\] dynamically associated with each process. It is sometimes called the current working directory (CWD), e.g. the BSD getcwd(3) function, or just current directory. When the process refers to a file using a simple file name or relative path (as opposed to a file designated by a full path from a root directory), the reference is interpreted relative to the current working directory of the p In...

Unless a special _“–sketch-path=”_ argument is passed to PApplet.**runSketch()**:

- [Forum.Processing.org/two/discussion/16457/size-method-for-intial-window-not-working-when-more-windows-are-are-added#Item\_1](http://Forum.Processing.org/two/discussion/16457/size-method-for-intial-window-not-working-when-more-windows-are-are-added#Item_1)

I believe the PDE (Processing’s IDE) creates its own customized **main(String[] args)** which passes all of those custom args to the compiled sketch.

And when we override it by making our own **main(String[] args)**, the PDE can’t pass _“–sketch-path=”_ to our sketch.

And since the CWD is where the PDE is located, our sketch inherits that path. 😖

---

_[View the full topic](https://discourse.processing.org/t/using-custom-main-string-args-breaks-file-reading-functions-in-windows-e-g-loadshader-loadimage/2572)._
